[Ur] rpc calls from signals?
Adam Chlipala
adamc at csail.mit.edu
Mon Mar 11 10:47:30 EDT 2013
On 03/11/2013 10:20 AM, Daniel Patterson wrote:
> Is there a way to call remote procedures in signal handlers? I looked
> through the manual and basis.urs and couldn't find anything.
>
> The use case isn't particularly strange: I want to persist client side
> changes on the server, ideally only making rpc calls when something
> actually changes. I can spawn a thread that checks periodically if the
> value has changed (that's what I ended up hacking together), but at
> that point I'm replicating imperatively what FRP is supposed to eliminate!
I would actually consider it a bug if what you ask were possible! The
[signal] monad is meant to rule out side effects, and RPCs can cause
arbitrary side effects, not just locally but out in the real world.
There would need to be some kind of type system, etc., to recognize RPCs
that are suitably pure. Imagine the consequences of the "launch
missile" RPC running every time the runtime system decides that some DOM
subtree needs recomputation. ;)
Why not implement a general library for change listeners? Certainly
there is some duplication with FRP, but at the same time I would expect
it's pretty straightforward to implement. You could create a new
abstract type that encapsulates a [source] plus change listeners.
More information about the Ur
mailing list