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

Re: Order of evaluation within applications



Amr Sabry writes:
> In Scheme's folklore, programs whose results depend on the order of
> evaluation are illegal programs.

That's not quite true; such programs are not illegal, they merely have a result
that's not fully specified.

> The only quote relevant to the subject is (p.8):
> 
> 	Note: In contrast to other dialects of Lisp, the order of
> 	      evaluation is unspecified ...
> 
> As is, the quote is ambiguous and has the following two valid
> interpretations:
> 
> 1. The order of evaluation is unspecified EVEN if the expression
> yields different answers under different orders. Any answer is an
> acceptable answer.

This is the correct interpretation.

> 2. An expression is a program ONLY when the value of the program is
> not sensitive to the order of evaluation. That implies that divergence
> under one order and an answer under another order are ok. 

First, I don't think that the quote above can be reasonably read in this way.
Second, I don't believe that you can exhibit a Scheme program that diverges
under one legitimate order of evaluation and converges under another, unless
you count signalling an error as convergence.

	Pavel