Re: ISSUE: Please consider laziness.

At 10:37 AM 1/14/2002 -0500, Shawn Vincent wrote:

>Summary: It is useful and good to have lazy (i.e. - call by need)
>          implementations of XQuery.  The spec should consider this,
>          and not accidentally forbid it.

Hi Shawn,

In fact, some implementations of XQuery currently do lazy evaluation, and 
at least some members of the Working Groups consider it important to allow 
lazy evaluation for the purpose of optimization, as you mention.

>Unfortunately, the XQuery specification does not seem to talk about
>laziness as an option for implementations, and many parts of the spec
>seem to imply that XQuery is strict (function arguments being
>evaluated BEFORE function application, for example).

I think that the current description of AND and OR is also problematic. Are 
there other such problems that you are aware of?

>For example, say I have a sophisticated, and deeply recursive type
>(say 'Organization').  Then, say I have a list of them.
>
>Say I have a function:
>
>   define function process-orgs (element of type Organization* $org-list)
>   {
>     ...
>   }
>
>If I invoked this function with a list of 20,000 Organizations, to
>dynamically check the type of the argument, will I have to check the
>input sequence deep at function call time?  This forces its evaluation
>in a profound way, and is in any case extremely expensive.

I did not understand this example.

Static type checking would not require evaluation. Dynamic type checking 
does require evaluation, and I can't think of how I would avoid evaluation 
but still be able to produce a dynamic type result. Could you please 
explain this in more depth?

Regardless, there are *lots* of other examples where lazy evaluation aids 
optimization.

>In summary, please take laziness into consideration when designing
>aspects of XQuery which might be affected by such an implementation.

I agree.

Jonathan

These are my opinions right now. They may be quite different from the 
opinions of Software AG, the W3C XML Query Working Group, or the opinions 
that I will have after reading and considering your response.

Received on Thursday, 24 January 2002 09:43:33 UTC