The main page doesn't do a great job of showing what's interesting about Grain vs. JavaScript. The only hint is this: "No runtime exceptions, ever. Every bit of Grain you write is thoroughly sifted for type errors, with no need for any type annotations." Maybe show some examples of errors Grain would catch that JavaScript wouldn't, like Elm does: http://elm-lang.org/
I don't think web languages should have comparisons with JS on their homepage now that we have wasm.
Grain: A strongly-typed functional programming language for the modern web
31–40 of 156 posts
Re: Grain: A strongly-typed functional programming language for the modern web
#32The main page doesn't do a great job of showing what's interesting about Grain vs. JavaScript. The only hint is this: "No runtime exceptions, ever. Every bit of Grain you write is thoroughly sifted for type errors, with no need for any type annotations." Maybe show some examples of errors Grain would catch that JavaScript wouldn't, like Elm does: http://elm-lang.org/
Re: Grain: A strongly-typed functional programming language for the modern web
#33Earlier quoted context omitted.
The JS way is a mistake, intentional or not. Here's a little thought experiment: Your program ends up with an "undefined" in some variable 'x'. How did that happen? In JS it can happen in any number of weird and wonderful ways, e.g. you called a function which did a 'v[i]' or it could have just fallen off the end because someone forgot to check a return path, or... In Python there's much less scope what the problem c…
But JS programs must execute in uncontrolled environments, e.g. browser engines from the past and future with random extensions installed. A bondage-and-discipline language may help developers find logic bugs, but will make the users' experiences worse.
Re: Grain: A strongly-typed functional programming language for the modern web
#34Earlier quoted context omitted.
I don't think web languages should have comparisons with JS on their homepage now that we have wasm.
The WASM devs have really been trying to correct the "WASM will replace JS" meme. I don't think any of them believe that it will, or even that it would be a good thing if it did.
Re: Grain: A strongly-typed functional programming language for the modern web
#35Why not just compile OCaml to wasm? Why another language?
Poking around in the sources, it looks like this is the OCaml compiler, with the frontend apparently tweaked to accept the new syntax. But this is not mentioned anywhere that I can see. The "Copyright copyright 2017-2018 Philip Blair and Oscar Spencer." line in the README is highly misleading in this context, since most of the actual source files are marked with OCaml's copyright header.
Considering ongoing efforts to create a WebAssembly backend for OCaml (and thus Reason), I wonder what would be the selling point of Grain.
Re: Grain: A strongly-typed functional programming language for the modern web
#36Re: Grain: A strongly-typed functional programming language for the modern web
#37Doesn't encourage immutability because variables are not readonly by default. I would advice the language designers to require the "mutable" keyword for variables than can be re-assigned. (Similar to F# approach.)
Re: Grain: A strongly-typed functional programming language for the modern web
#38Doesn't encourage immutability because variables are not readonly by default. I would advice the language designers to require the "mutable" keyword for variables than can be re-assigned. (Similar to F# approach.)
Re: Grain: A strongly-typed functional programming language for the modern web
#39The main page doesn't do a great job of showing what's interesting about Grain vs. JavaScript. The only hint is this: "No runtime exceptions, ever. Every bit of Grain you write is thoroughly sifted for type errors, with no need for any type annotations." Maybe show some examples of errors Grain would catch that JavaScript wouldn't, like Elm does: http://elm-lang.org/
I wonder how they handle array out-of-bounds accesses...