Moving ahead Marc Feeley (07 Mar 2003 22:09 UTC)
Re: Moving ahead felix (08 Mar 2003 13:40 UTC)
Re: Moving ahead Marc Feeley (08 Mar 2003 14:38 UTC)
Re: Moving ahead Alhambra Petrofsky (08 Mar 2003 17:09 UTC)
Re: Moving ahead Marc Feeley (09 Mar 2003 03:40 UTC)

Re: Moving ahead Marc Feeley 08 Mar 2003 14:37 UTC

> Is it really necessary for SRFI-39 to specify this? As per R5RS `delay'
> and `force' are defined clearly without capturing the dynamic context.
> So in the obvious implementation of `with-output-to-file' (via `dynamic-wind')
> promises would not retain the dynamic environment and your example
> would not behave as you intended.
>
> Moreover, it might be useful to change the context in which the force
> happens (say, I'd want to redirect output to a log file, or a custom
> `tee' port).

I think this SRFI has to specify what happens with DELAY, because
DELAY is required by R5RS.  Doing nothing special as you propose would
not be modular.  Let's call the piece of code that creates a promise
the "creator" and the piece of code that forces it the "forcer".  Then
in your approach the creator needs to be aware of the forcer(s) and
the forcer(s) need to be aware of the creator (because the dynamic
environment of the creator and forcer is not the same in general).
This is not modular.  Note that the lambda form does not close over
the dynamic environment so why should it be different from delay?
Well if you did this the "dynamic environment" would in fact be the
lexical environment so you would lose all the benefits of dynamic
binding.  When one writes a function with lambda there is an
expectation that the dynamic environment is abstracted over.  However
when using a DELAY the expectation is that only the evaluation time
is changed, not the computation being performed (unless side-effects
are performed that expose the evaluation order).

Marc