From: Dmitriy S. <sha...@gm...> - 2010-08-09 17:18:39
|
On Mon, 2010-08-09 at 18:31 +0200, Pieter Deelen wrote: > On Mon, Aug 9, 2010 at 5:32 PM, Dmitriy Shabanov <sha...@gm...> wrote: > > On Mon, 2010-08-09 at 16:32 +0200, Pieter Deelen wrote: > >> xs:string(()) should yield () > > > > It's confuse me, can you point spec. > > http://www.w3.org/TR/xquery/#id-constructor-functions states (T is a > type, e.g., xs:string): > "The semantics of the constructor function call T($arg) are defined to > be equivalent to the expression (($arg) cast as T?)" > > So xs:string(()) is equivalent to () cast as xs:string?. > > http://www.w3.org/TR/xquery/#id-cast tells us what this means: > "If the result of atomization [of the input expression] is an empty sequence: > 1. If ? is specified after the target type, the result of the cast > expression is an empty sequence. > 2. If ? is not specified after the target type, a type error is > raised [err:XPTY0004]." > > Hence, () cast as xs:string? evaluates to (). xs:string(()), > therefore, also evaluates to (). That is the strangers part of the spec. I have to agree :-/ -- Cheers, Dmitriy Shabanov |