W3C home > Mailing lists > Public > public-qt-comments@w3.org > June 2004

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

From: Per Bothner <per@bothner.com>
Date: Wed, 23 Jun 2004 08:47:47 -0700
Message-ID: <40D9A623.3060801@bothner.com>
To: Michael Kay <mhk@mhk.me.uk>
Cc: "'Liam Quin'" <liam@w3.org>, public-qt-comments@w3.org

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

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:45:20 UTC