[xquery-talk] How much laziness is permitted?

Florent Georges lists at fgeorges.org
Wed Mar 11 17:59:22 PST 2009


John Snelson wrote:

> try { 1, 2, 3, error() } catch * { "doh!" }

> Typically, lazy evaluation will start returning items from
> expressions one by one as they are requested. So lets say I
> request an item from the expression above, and it gives me
> 1. I do this a couple more times and it gives me 2 and 3.
> Then the next time I request an item, the error() function
> raises an error - and the implementation says "Oh -
> wait a minute! Give me back those answers, I didn't mean
> them - I meant to return 'doh!'.".

  Thanks.  But I still fail to see the exact problem.  If you use the whole sequence, or its 4th item, then lazy evaluation is not concerned if I am right.  And if you just use its 1st item (for instance) then an implementation is allowed to NOT report the error if it does not want to (if I am right.)

  Of course, this last rule could me more confusing in case of try/catch.  Is it the issue or still I missed it?

  Regards,

-- 
Florent Georges
http://www.fgeorges.org/






















      



More information about the talk mailing list