4 ms·
I think we agree that FRP-ish is the way of most of the future, but it must integrate well into the existing ecosystem. Which basically means no "projection int
by lomnakkus 9y ago
I think we agree that FRP-ish is the way of most of the future, but it must integrate well into the existing ecosystem. Which basically means no "projection into the future" and no "fast-forward". I think side effects are unavoidable for all practical purposes -- the trick is how to integrate them cleanly, if that's even possible. Even being able to trace backward would be a huge achievement for most of the programming world. To be clear, it's about 80% achievable right now by just programming your whole application in the FRP style until you reach the "transactional" or "IO" boundary.... Btw, it's not a coincidence that this sounds similar to CQRS/Event Sourcing and Bounded Contexts from DDD. I think CQRS/ES approach has an advantage in that it "realizes" that there's such a thing as "oops, I wrongly charged customer X for item Y, let's refund that". Plus, it's it's basically what we do in the real world, e.g. in banking.
It's obviously not enough to be able to "project into the future", but it's pretty awesome for looking at what happened. It's also a great way to maintain discipline for your code -- we're already off on a wild tangent here, so I won't elaborate.
> I'm curious though, why you suggest for a language to work like this you have to abandon Turing Completeness
You don't necessarily have to, as long as you a) assume complete purity (as in e.g. Haskell's ST monad), and b) are resigned to having to actually run all the computations when running "forward".
Keep in mind that some of those computations may be EXPTIME... but as long as you can interrupt them, then I suppose that's OK.
I think the conclusion is that anything TC that doesn't do side-effects would basically be OK (as in: not actively wrong), but not necessarily practical in our lifetime. Timeouts might work here, actually.
- jecel 9y agoIt isn't clear to me what the problem with projecting into the future is. You just simulate the system or just let it execute normally (but under the control of some kind of "harness"). This will give you the correct result up to the point where some user input (missing in this simulation or execution) would have changed the behaviour.
- lomnakkus 9y ago> You just simulate the system or just let it execute normally (but under the control of some kind of "harness") "Simulate the system" means "execute normally" for all practical purposes. That's what TC + Halting Problem[1] essentially boils down to, absent other knowledge about the program. Hence my suggestion to let the program itself do "projection" because it could potentially be hugely more efficient, and possible (but perhaps with bad "fidelity" in the case of side-effecting computation). Anyway... to the larger point and to expound a little: If everything is pure, then there's basically no problem (except computational cost), but imagine our Mario is taking part in a multiplayer game. What do you think should happen? (Obviously, this is not realistic for the reason that you usally don't run "debuggers" or "IDEs" in a 'multiplayer' scenario, but I think the analogy holds in general. Imagine that the other players' actions are I/O operations like "what's the current time?" or "talk to a REST service", etc.) Most interesting programs do this kind of thing all the time. Of course, there are interesting programs/functions which are purely algorithmic and rewind/fast-forward should work for them, but they are mostly pretty niche compared to most of the programming that currently happening. A very interesting example that's somewhere "in between" is Haskell's STM monad which does have very controlled side effects and where you can just "retry" and particular computation in case synchronization fails, but it still doesn't allow you to "project". [1] Alright, I suppose it's just undeciability for non-trivial properties of TCs languages, but Halting Problem is a convenient shorthand.