Re: XS: possible to have side effects?

Subject: Re: XS: possible to have side effects?
From: James Clark <jjc@xxxxxxxxxx>
Date: Mon, 09 Jun 1997 11:25:20 +0700
At 14:09 08/06/97 -0400, G. Ken Holman wrote:
>Please pardon my confusion, but I'd like to ask something about this.
>
>At 13:34 97/06/08 +0700, you wrote:
>>given
>>
>>  (define x (let ((n 0)) (lambda () (set! n (+ 1 n)) n)))
>>
>>repeated calls to (x) will return 1, 2, 3,...
>
>Then doesn't calling this routine create a side effect?  The return value
>isn't deterministic based on one's location within a grove.

Sorry I wasn't clear.  This is the behaviour in Scheme.  It can't be allowed
in DSSSL for the reason you give.  With my proposal for limited side-effects
in DSSSL, this procedure would produce a run-time error in DSSSL (or at
compile time with a smart implementation), because the location of n would
be marked as read-only when the the closure was bound to x.

James


 DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist


Current Thread