[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: letrec and set!

At  8:14 AM 8/19/93 +0200, Christian Queinnec wrote:
>It is written in R4RS section 4.2.2 that "One restriction on letrec is very
>important: it must be possible to evaluate each <init> without ASSIGNING
>or referring to the value of any <variable>. Why assigning is forbidden ?
>It rules out some programs that are unambiguous such as:
>(letrec ((x (begin (set! y 1)
>                   y ))
>         (y 3) )
>  x )
>              ---> 1
>The value of y is not foreseeable but the result of x seems clear. 

If the assignments happen to be done on different processors or on the samp
processor using futures the value of X is timing dependent.  It could be 1
in some invocations and 3 in others.  While this lack of determinism can
have some benefits, e.g. in generating random seeds, it is not very useful
in general.

Note that it has been suggested that LETREC be restricted to only bind
LAMBDA forms which avoids the potential user trap.  This was the choice
taken by EULisp (their construct is called LABELS).