elm / core

Elm's core libraries
http://package.elm-lang.org/packages/elm/core/latest
BSD 3-Clause "New" or "Revised" License
2.79k stars 359 forks source link

Please I implore you to bring back the R in FRP! (reactive objects) #843

Closed razcore-rad closed 7 years ago

razcore-rad commented 7 years ago

Hello community. So a 5 sec backstory: I discovered Elm a week ago more or less after playing with reactiveX.

I understand that before Elm 0.17.1 there was a lot of confusion with streams and they were taken out. I think the new loop mechanism is actually pretty good and simpler, but on the other hand I think streams (reactive objects) are invaluable for UI development especially (which Elm is targeting), but more generically for everything.

I think that the update mechanism prior to 0.17.1 using streams was very limited and the streams were used in their most basic form (only filter/map/merge/and this weird foldp). But streams are much more than this.

Let me ask you a question: how would you implement gesture recognition in Elm? Let's start with something super simple like a double tap (on touch devices). Funny enough I started working on this in Elm and then I realized that there was no R in FRP :(. You'd probably end up doing something fancy with some state (model) and tie it together with some Time types/functions etc. Well please check this reactiveX example first to understand how easy this is with reactive objects: http://jsfiddle.net/staltz/4gGgs/27/. Now go and try to implement something like this in Elm.

OK so I want to make one thing clear. I think that the current update loop architecture is very well done for its purpose. I'm just saying that reactive streams/objects can complement it very nicely.

Taking the reactiveX example say you have an object in Elm that can behave like exactly like that along side the core loop and then in the subscription part you return a Msg which is then fed to update. This wouldn't break anything in Elm it would just make it awesome!

Let's make Elm great again? :P

process-bot commented 7 years ago

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

popara commented 7 years ago

http://elm-lang.org/blog/farewell-to-frp

You are jumping the ball on this one. Your best intentions would rumble many hours of good people's work.

avh4 commented 7 years ago

Please see https://github.com/process-bot/contribution-checklist/blob/master/issues.md#issues

This discussion is more suited to one of the community forums http://elm-lang.org/community