> One of the wonderful things about functional languages is that they
> do not prescribe the order of evaluation.  To achieve the effect you
> want would require us to completely prescribe that order, with very
> bad effects on efficiency.  For example, consider
> ...
> But if we are required to ensure consistent choice of exception
> values then we can't do that any more, because the producer
> might evaluate the thunks in a different order to f.

There is one aspect of Java that is relevant here:

A Java implementation is free to load and link classes in any order,
strictly or lazily, but it MUST report exceptions as if it had loaded
and resolved the classes lazily.

I think Haskell should have the same restriction: it would bad to
receive different exceptions because a Haskell implementation decided
to evaluate an argument strictly before it is needed. 

Java got that right. --Amr


Reply via email to