Re: lazy or eager variable initialization? [qt-2004Feb1090-01]

Michael Kay wrote:

>>declare variable $x { $y };
>>declare variable $y { 10 };
>>$x + $y
>>
>>Is this portable, implementation-defined, or neither?
>>What about more complex expressions that depend on
>>lazy evaluation?
> 
> This example doesn't depend on lazy evaluation. It places some demands on
> the order of evaluation, but that's not the same thing. Lazy evaluation is
> just one strategy for handling this. 

It's not the same, but lazy evaluation does make this example
well-defined.  Compile-time re-ordering also makes it well-defined,
but it can be tricky to implement *and* specify when crossing
module boundaries.

So the question remains:  is the example portable,
implementation-defined, or neither?
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

Received on Wednesday, 23 June 2004 11:47:52 UTC