Re: XQuery

> Allowing implementations to choose order-of-evaluation in most 
> circumstances is very important (for implementation strategies and query

> performance).
> However, choosing order-of-evaluation is inhibited by certain kinds of
> expressions, especially errors.  If an implementation is constrained to
> check that an error could occur, then it cannot fully re-order the
query.
> For example, if an implementation had to check that a.xml exists and is
> well-formed in both of the queries above ... well, that would "suck."
> 
> When Michael Kay says he would prefer the where clause in your example
> return false instead of raising a dynamic error, he's really voting to 
> allow implementations to choose the order-of-evaluation.

I completely support this and want to explain it from another angle:

Arguing against "non-determinism" in XQuery is in fact arguing against its
being a functional (side-effects-free) language.

More on the relationship of non-determinism to exception handling in
functional languages can be found in [1].

There, Simon-Peyton Jones says:

"In particular, by confining the non-deterministic choice to the IO monad
we have prevented non-determinism from infecting the entire language."

There is a type-safe way to specify and implement order of evaluation in a
functional language e.g. monads (the Haskell's do-notation), but such an
implementation would be very difficult without having higher-order
functions and lazy evaluation.

None of these two is defined in XPath 2.0 and XQuery, therefore
implementing monads in the current version of these languages would be
like putting the cart in front of the horse.

I think, however, that monads should be considered very seriously for a
language such as XUpdate, if this language is to remain a functional one.







=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL

__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

Received on Thursday, 16 October 2003 15:14:39 UTC