[Bug 14152] [F+O30] A enumerator function

http://www.w3.org/Bugs/Public/show_bug.cgi?id=14152

--- Comment #2 from Vladimir Nesterovsky <vladimir@nesterovsky-bros.com> 2011-09-23 18:55:06 UTC ---
(In reply to comment #1)
> There might be a technical issue with the fact that there is no evaluation
> order in XPath 3.0 as far as I know. Even if the function item returned by
> fn:enumerator is annotated as non-deterministic (i.e., can return a different
> result for each call), if I am correct, the following query:
> ...

1. More correct definition of the enumerator function should be:
  fn:enumerator($items as item()*) as function() as item()?;

fn:enumerator() returns a function item (which is non-determenistic) that
returns optional item.

2. According to my reading of XQuery 3.0 WD (3.9.2 For Clause), and XPath 3.0
WD (3.8 For Expressions) one may write a code like a following to avoid the
issue you're pointing to:

let $enumerator := fn:enumerator((1,2)) return
for $v1 in $enumerator(), $v2 in $enumerator() return ($v1, $v2)

> Are there use cases requiring order preservation?

I think such use cases do exist.

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Friday, 23 September 2011 18:55:08 UTC