W3C home > Mailing lists > Public > public-qt-comments@w3.org > December 2003

RE: [XQuery] static typing of node comparisons

From: Kay, Michael <Michael.Kay@softwareag.com>
Date: Tue, 2 Dec 2003 12:46:09 +0100
Message-ID: <DFF2AC9E3583D511A21F0008C7E62106073DD301@daemsg02.software-ag.de>
To: Michael Rys <mrys@microsoft.com>, Dimitre Novatchev <dnovatchev@yahoo.com>, David Carlisle <davidc@nag.co.uk>, public-qt-comments@w3.org
> 
> We investigated these (and some other) options in depth in 
> the WG and finally decided to be pessimistic in the first 
> version of the static typing rules to avoid the runtime checks.
> 

But of course, you still have to do the run-time checks if the user can only
get the thing to compile by adding a call on exactly-one().

It seems to me that with optimistic typing the process is:

1. At compile time, the system decides that there might be more than one
item, so it generates code to do a run-time check.
2. At run-time, the system checks that the sequence is a singleton.

With pessimistic typing, the equivalent process is:

1. At compile time, the system decides that there might be more than one
item, so it rejects the query.
2. The user edits the query to add a call on exactly-one().
3. At run-time, the system evaluates the call on exactly-one() by performing
a run-time check that the sequence is a singleton.

I think I know which I prefer.

Michael Kay
Received on Tuesday, 2 December 2003 06:47:38 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:14:03 GMT