[racket-dev] FrTime propagation bug
Hi Marijn,
FrTime propagates changes asynchronously. When send-event returns, there's
no guarantee that the event has finished propagating through the system.
And in general, (value-now b) is not well-defined, since asynchronous
processing makes it difficult to define what "now" means; programs should
only call this if they can tolerate stale values.
(It so happens that evaluating (hold a) blocks your thread until the event
finishes propagating, but that's an implementation detail. You can
probably achieve the same effect through a call to "sleep", for example.)
Greg
On Wed, Jan 11, 2012 at 8:08 AM, Marijn <hkBst at gentoo.org> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
>
> Consider:
>
>
> #lang racket
>
> (require frtime)
>
> (define a (event-receiver))
> (define b (hold a))
>
> (send-event a 3)
>
> ;;; uncomment next line to make it work
> ;(value-now (hold a))
> (value-now b)
>
>
> `a' is an event-stream onto which the value 3 is sent. `b' is the
> behavior produced by holding the last value seen on `a'. After the
> value 3 arrives on `a', `b' should hold to 3. But it doesn't unless
> you ``help'' frtime a bit...
>
> Marijn
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.18 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk8Ns/8ACgkQp/VmCx0OL2yahwCcDFs/1kL+m4PVhfmPdkjTQTcu
> KmMAnjLaAAHPYvCM1eKkLXl0EBCuXRkE
> =mrh9
> -----END PGP SIGNATURE-----
> _________________________
> Racket Developers list:
> http://lists.racket-lang.org/dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/dev/archive/attachments/20120111/07869ebd/attachment.html>