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

RE: [XQuery] static typing of node comparisons

From: Dimitre Novatchev <dnovatchev@yahoo.com>
Date: Mon, 1 Dec 2003 13:21:58 -0800 (PST)
Message-ID: <20031201212158.39121.qmail@web41104.mail.yahoo.com>
To: Michael Rys <mrys@microsoft.com>, David Carlisle <davidc@nag.co.uk>, public-qt-comments@w3.org

--- Michael Rys <mrys@microsoft.com> wrote:
> While I understand David's sentiment, we need to understand the dynamic
> semantics first if I expect a singleton and I get a sequence passed that
> may be longer. 

It is logical in this case to use the first item of the sequence for the
operation and to ignore the rest.

The operation expects a single argument. It gets a sequence of more than
one argument. Therefore it has the single argument needed -- and this is
the first item of the sequence.

Why operate on the first item? Because this will work in every case --
even in the case when the sequence consists of just one element.

This semantics may seem "strange". However, it has been proven to be
useful and effective in practice when it is well documented and known. If
many thousands of programmers are using XPath 1.0 without problems then
why should this semantics be changed?

If the change was needed to simplify and correct something, then it
obviously didn't achieve these goals -- we are commenting on the anomalies
of the "pessimistic static typing", which require either relaxing the type
so much as to render it useless, or using dynamic-cast clutches such as 
zero-or-one(), one-or-more() and exactly-one().

If this (otherwise well-intended) attempt to simplify and correct the
XPath 1.0 semantics is failing so obviously, then the conclusion is to
follow the semantics of XPath 1.0, which, although seeming "strange" at a
surface glance, has passed the reality tests by serving well its users.

Using this semantics it is possible to have type-checking that does not
exhibits the anomalies discussed, does not need any clutches and is really

Dimitre Novatchev

Do you Yahoo!?
Free Pop-Up Blocker - Get it now
Received on Monday, 1 December 2003 16:21:59 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:45:15 UTC