3 ms·
Your comparison of FRP is fairly accurate, but let me reply to a couple of points: > for example, you might want to filter events when a game is paused. The c
by seanmcdirmid 13y ago
Your comparison of FRP is fairly accurate, but let me reply to a couple of points:
> for example, you might want to filter events when a game is paused. The code would just look roughly like this:
In Glitch/YinYang this is:
on Tick:
if !Paused: fire game.Step
Basically, the entire program is lifted over time, whereas in FRP, only values are. But the effect is very similar.
> thinking about FRP programs as dataflow networks with explicit propagation and so on. While you can think of FRP like this, I personally find this neither natural nor helpful—it also doesn't really get into the "functional" spirit of FRP, which originally came out of the Haskell community.
Propagation is implicit, not explicit, I think. Conal's original Fran work has a very data flowy feel to it, as "composed" functional code does in general. The only place where the syntax becomes more procedural again is in the less pure push-based FRP systems (like FrTime, Flapjax).
> Instead, I prefer thinking about FRP as just programming with time-varying values largely as normal values, and keeping the actual implementation details under the ambient level of abstraction as much as possible.
I had this goal with my own FRP work also, but to get there I came up with something very different. Basically, think of Glitch as being something like "time-varying code" vs. FRP's time-varying values.
> [1]: It's possible to come up with very elegant semantics for FRP systems that let you not worry about the particular details of how time is implemented or how time changes. It makes your code "resolution independent" over time—it's like using vector graphics instead of raster graphics.
Even vector graphics must be rasterized at some point. For most programming tasks, a notion of event-time (with everything staying the same in between as in Glitch) is quite useful. There aren't that many tasks that require continuous time abstractions (e.g. animations can be chopped up into 15 millisecond chunks).