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

RE: document is not an element, is it?

From: Todd A. Mancini <todd.mancini@daxat.com>
Date: Mon, 10 Mar 2003 17:35:55 -0500
To: "'Jonathan Robie'" <jonathan.robie@datadirect-technologies.com>, "'MW'" <onlymails@gmx.net>, <public-qt-comments@w3.org>
Message-ID: <000c01c2e755$7c117330$0201a8c0@qodfathr>

>At 06:04 PM 3/9/2003 +0100, MW wrote:
>>Hi Jonathan!
>>In the working draft "XQuery 1.0: An XML Query Language" in chapter
>>Function Definitions" there is this example:
>>define function depth($e as element) as xs:integer
>>   {-- An empty element has depth 1 --}
>>   {-- Otherwise, add 1 to max depth of children --}
>>   if (empty($e/*)) then 1
>>   else max(for $c in $e/* return depth($c)) + 1
>>But this function does not run in GALAX. And I think it is obvious
>>the function must not work, because the funktion-parameter is declared

>>as  "element", but it is called with a parameter of type "document". I

>>think the declaration must be changed  from "element" to "item".

>Right, that's a bug in the spec.

Just to keep everything clear, and I cannot speak for GALAX, but isn't
'node*' the return type of the document() function, not the 'document'
type?  The 'document' type results from computed document constructors,
not calls to the document() function.

Furthermore, would it not be a static type error to rewrite the function
so that the argument type is 'item' rather than 'element', as was
suggested?  'node*' is not a subtype of 'item' (but 'item*' would be
valid, as would, of course, 'node*', which is what I would recommend for
the argument type).

Received on Monday, 10 March 2003 17:36:45 UTC

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