Re:Optimistic UI and Reactive Programming with Elm
by vvanders on Sunday July 26, 2015 @03:20PM
(#9951931)
The one thing I really like in react is the composability. I haven't seen a mechanism a nice in elm like the virtual dom. It seems like things are much more verbose with one-way signals.
Re:Optimistic UI and Reactive Programming with Elm
by masklinn on Sunday July 26, 2015 @04:17PM
(#9952080)
> I haven't seen a mechanism a nice in elm like the virtual dom.
It's not quite clear what you mean, the "view" function of a standard Elm application is a virtual dom, elm.html is implemented on top of the virtual-dom library[0]. If you mean component, as far as I understand in Elm you'd use separate models and sub-functions in separate modules for each concern ("component")[1]. Elm subscribes to the "single point of truth" philosophy[2] so there isn't really a sense of component-local state or lifecycle.
Re:Optimistic UI and Reactive Programming with Elm
by skybrian on Sunday July 26, 2015 @07:02PM
(#9952515)
Composition of components in Elm is still being worked out, to judge by discussions on the mailing list [1], [2]. To do things like animating components, you still need to store the temporary state somewhere.
Re:Optimistic UI and Reactive Programming with Elm
by spuz on Sunday July 26, 2015 @04:24PM
(#9952100)
Also, I'd recommend reading the Elm Architecture Tutorial[0]. It shows how to separate your code into modules with view/model/update sections and how this separation naturally leads to composable components where parent-child relationships are created simply by delegating the view calls from parent module to child module.
Re:Optimistic UI and Reactive Programming with Elm
by marknutter on Monday July 27, 2015 @08:30AM
(#9954719)
Why does the virtual DOM have anything to do with composability? The virtual DOM is a mechanism that works under the hood to provide diffing that doesn't rely on expensive DOM operations, and thus should be completely transparent to the developer. Composability is purely a syntax thing, provided by JSX, and has existed in other frameworks with components for years (Angular, Ember, etc).
That said I really like the rest of the language.
It's not quite clear what you mean, the "view" function of a standard Elm application is a virtual dom, elm.html is implemented on top of the virtual-dom library[0]. If you mean component, as far as I understand in Elm you'd use separate models and sub-functions in separate modules for each concern ("component")[1]. Elm subscribes to the "single point of truth" philosophy[2] so there isn't really a sense of component-local state or lifecycle.
[0] https://github.com/Matt-Esch/virtual-dom
[1] https://gist.github.com/evancz/2b2ba366cae1887fe621#nesting
[2] like Om except more so
[1] https://groups.google.com/forum/?fromgroups#!searchin/elm-di...
[2] https://groups.google.com/forum/?fromgroups#!topic/elm-discu...
[0] http://elm-lang.org/guide/architecture
Im not familiar with react, and im not quite sure what you mean by that, but elm html is based on virtual-dom...
http://elm-lang.org/blog/blazing-fast-html