|
|
|
|
|
by jdreaver
3795 days ago
|
|
I just wanted to respond to this: > It's not immediately clear to me how e.g. throttle is implemented, but it must accumulate state inside it somehow in order to replay the event after the timer. Certainly, a lot of FRP (and functional programming in general!) concepts involve state. I would never argue that there is no state in functional programming, just that the state is more explicit, localized, and easier to reason about. In fact, in pure FRP, there are two fundamental building blocks: Behavior and Event. A Behavior is simply a value over time, and an Event is a value at an instant in time. Therefore, Behaviors are where you store state. However, what makes them "easier to reason about" is that oftentimes the API forces you to construct them in a way that makes all of the possible ways to change the Behavior are clear and present at once. In summary, all inherently stateful concepts require stateful code, at lease somewhere under the hood. I would say that FRP and functional programming just make the state explicit. |
|