News for hackers. Stuff that matters.
Re:Grain: A strongly-typed functional programming language f... by thangngoc89 on Tuesday July 31, 2018 @01:54AM (#17650850)
I think the marketing page is not doing a great job. Grain is a language compiled to WebAssembly. So comparing it with either Javascript or Elm is pointless
Re:Grain: A strongly-typed functional programming language f... by masklinn on Tuesday July 31, 2018 @05:51AM (#17651816)
> Grain is a language compiled to WebAssembly. So comparing it with either Javascript or Elm is pointless

This ability is a tool and nothing precludes a wasm target for Elm (in fact Evan specifically expressed interest in it: https://github.com/WebAssembly/gc/pull/1#discussion_r1115011...).

Either way, comparing Grain to JS or Elm is anything but pointless, at the end of the day it's competing with them.

Re:Grain: A strongly-typed functional programming language f... by bad_user on Tuesday July 31, 2018 @08:37AM (#17652643)
If we're speaking of competition and JavaScript, then a much stronger competitor would be PureScript.

http://www.purescript.org/

PureScript is a Haskell dialect that was built specifically to run on top of JavaScript engines. Specifically, compared with Haskell, it is strictly evaluated (whereas Haskell is non-strict / lazy, well almost). However it eliminates some of Haskell's baggage, but retains Haskell's functional purity.

It's all around an awesome programming language for FP that targets JavaScript engines, far surpassing any other attempt.

Re:Grain: A strongly-typed functional programming language f... by tlrobinson on Tuesday July 31, 2018 @02:02AM (#17650884)
> So comparing it with either Javascript or Elm is pointless

Why? They all target browsers. What else would you compare it to?

Re:Grain: A strongly-typed functional programming language f... by thangngoc89 on Tuesday July 31, 2018 @02:06AM (#17650899)
Like comparing to Rust compilation to WebAssembly for example?
Re:Grain: A strongly-typed functional programming language f... by ForHackernews on Tuesday July 31, 2018 @04:52AM (#17651583)
Does Rust have any DOM integration?
Re:Grain: A strongly-typed functional programming language f... by ekidd on Tuesday July 31, 2018 @05:40AM (#17651782)
Yes. For a while, you've been able to embed JavaScript wrappers using stdweb (https://github.com/koute/stdweb). There are pre-built libraries covering much of the DOM. But you may need to submit PRs if you get heavily into <video> or something else with non-standard APIs.

The shiny new toy is wasm-bindgen (https://github.com/rustwasm/wasm-bindgen), which will soon allow the use of WebIDL (https://heycam.github.io/webidl/) to wrap the entire browser API, if I understand correctly.

In practice, it all seems to work pretty well. But for public-facing sites, you need to watch the number of dependencies you include and keep the *.wasm size down.

Re:Grain: A strongly-typed functional programming language f... by masklinn on Tuesday July 31, 2018 @05:49AM (#17651807)
There are vdom/components-based libraries based on that as well e.g. Yew seems popular.
Re:Grain: A strongly-typed functional programming language f... by vijaybritto on Tuesday July 31, 2018 @02:57AM (#17651092)
They've even got the ability to query dom using a light weight lib on the js side. I think this is a more full fledged framework and they should really talk about it. The marketing page is not upto other frameworks imo.