Re:A Farewell to FRP
by timroy on Tuesday May 10, 2016 @12:28PM
(#11668397)
"if it compiles, then it just seems to work"
Man, now that is tempting.
Also, how easy are the ports? In ClojureScript you can use JavaScript pretty directly, but I often got a bit hung up translating the syntax (it's not that hard, it was just me).
[ Parent
| on HN ]
I've never used ClojureScript so I can't speak for that, but the ports are now a lot easier in 0.17 as an outgoing port is simply a function that you can call, instead of messing about with Signals. Effectively, you send stuff to Javascript by calling the port function with a Javascript compatible value, and then you subscribe to messages on the way back in, which end up triggering a message on the update function of whatever component sent it out in the first place.
TL;DR its pretty easy once you've done it a few times
Ports are essentially event emitters. You can expose them from elm, and in your JS code you attach event handlers to them using .onMessage (I think, been a while).
You can post and receive messages from ports (depending on type). Type checking is done at runtime to make sure nothing breaks.
Cljs interop is easier (can just call a function directly).
Apparently a human-readable homoiconic language is still an unsolved problem...
In 0.17, commands and subscriptions mean that, not matter how deep you nest components, you can still send and receive messages to/from the outside world (i.e. ports).