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

Re: order of evaluation




> As I don't think that the <some unspecified order> of LET means a pure random
> order that is neither sequential from left to right nor sequential from right
> to left, I wonder what the rationale for <unspecified order> evaluation of LET
> is.


The rationale for <unspecified order> in LET is that LET is
essentially a special case of procedure application, e.g.

(LET ((a X) (b Y)) (f a b)) => ((LAMBDA (a b) (f a b)) X Y),

and the order of evaluation of argument expressions in a
rocedure application is unspecified as well in R5RS.

Now the rationale for <unspecified order> in procedure
application is...

...not really obvious to me, either. My guess:

a) Theory people like it big time because the order of
evaluation of argument expressions is a non-essential
feature of the model, and would have to be introduced
into the semantics artificially afterwards.

b) Implementations are free to choose the internal
representation of argument lists, and hence also the
algorithms for evaluating these expressions.

What good this actually does in practice you have to ask
somebody else, but since <unspecified order> is a given in
Scheme/R5RS one can better be very careful not to rely on
some particular order because that is major portability risk.

Anyhow, since the existing implementation do not agree on the
order of evaluation of arguments the chance that it will become
fully specified in R^nRS, for some n > 5, are zero.

That is the reason I usually preserve the indeterminism of R5RS
when introducing binding constructs---although I agree with
your point of view that it shouldn't be there in the first place.

Cheers,

Sebastian