Re: [racket-dev] FrTime propagation bug

2012-01-13 Thread Marijn
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 12-01-12 18:27, Gregory Cooper wrote:
 Hi Marijn,
 
 The value-now/sync procedure waits for propagation to complete
 before reading a signal's value.  Would something like the
 following suit your purposes?
 
 (define a (event-receiver)) (define b (event-receiver)) (define a+b
 (+ (hold a) (hold b))) (send-event a 3) (send-event b 5) 
 (value-now/sync a+b)  ; read a+b after propagation = 8
 
 Or, even simpler:
 
 (define c (new-cell)) (define d (new-cell)) (define c+d (+ c d)) 
 (set-cell! c 3) (set-cell! d 5) (value-now/sync c+d)
 
 Greg

Thanks Greg, that helps a lot,

Marijn
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.18 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk8P8XkACgkQp/VmCx0OL2z0zACeJC+KOeUcuykFuCo8zfUv/nnm
RhQAnAvkx7TelLpiQHqSHr26Pu0BC8Ib
=KRNI
-END PGP SIGNATURE-
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] FrTime propagation bug

2012-01-12 Thread Gregory Cooper
Hi Marijn,

The value-now/sync procedure waits for propagation to complete before
reading a signal's value.  Would something like the following suit your
purposes?

(define a (event-receiver))
(define b (event-receiver))
(define a+b (+ (hold a) (hold b)))
(send-event a 3)
(send-event b 5)
(value-now/sync a+b)  ; read a+b after propagation = 8

Or, even simpler:

(define c (new-cell))
(define d (new-cell))
(define c+d (+ c d))
(set-cell! c 3)
(set-cell! d 5)
(value-now/sync c+d)

Greg

On Thu, Jan 12, 2012 at 12:49 AM, Marijn hk...@gentoo.org wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 On 11-01-12 21:26, Gregory Cooper wrote:
  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.

 Hi Gregory, so just to make sure I understand the implications of
 this: there is no way to do something like the following:


 #lang racket

 (require frtime)

 (define a (event-receiver))
 (define b (event-receiver))

 (define a+b (... ??? (merge-e a b)))

 (send-event a 3)
 (send-event b 5)

 (... ??? make sure everything is consistent again)

 (... ??? get the value 8 out of a+b)


 Marijn
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v2.0.18 (GNU/Linux)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

 iEYEARECAAYFAk8OnpkACgkQp/VmCx0OL2z8tACffv+uhmEAttZ7YhZ4UStbQR6p
 bFIAn3KOoI5uxWU+5hbWHxxJLgih8l7M
 =0Y03
 -END PGP SIGNATURE-

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


[racket-dev] FrTime propagation bug

2012-01-11 Thread Marijn
-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


Re: [racket-dev] FrTime propagation bug

2012-01-11 Thread Gregory Cooper
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 hk...@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

_
  Racket Developers list:
  http://lists.racket-lang.org/dev