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

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

From: Michael Kay <mhk@mhk.me.uk>
Date: Wed, 23 Jun 2004 14:03:07 +0100
To: "'Per Bothner'" <per@bothner.com>, "'Liam Quin'" <liam@w3.org>
Cc: <public-qt-comments@w3.org>
Message-Id: <20040623130520.9B1E0A131C@frink.w3.org>

> 
> Permitted, or required?
> 
> Consider something as simple as:
> 
> 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. 

In some functional programming language there is a requirement that lazy
evaluation is used to prevent infinite sequences arising when evaluating
certain expressions. XQuery/XPath imposes no such requirements, it's left to
the implementation, which means that some implementations will fail (run out
of memory or time) with such constructs, when others succeed.

Michael Kay
Received on Wednesday, 23 June 2004 09:05:28 UTC

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