Ah, that makes sense.  Scary.  Thanks Danny.

-W

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Danny Sokolsky
Sent: Friday, June 17, 2011 1:05 PM
To: General MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Why does xs:boolean(())=()?

Looks like function mapping to me.  You are running the function 0 times, so it 
returns empty.

http://docs.marklogic.com/4.2doc/docapp.xqy#display.xqy?fname=http://pubs/4.2doc/xml/xquery/enhanced.xml%2355459

-Danny

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Will Thompson
Sent: Friday, June 17, 2011 10:58 AM
To: General MarkLogic Developer Discussion
Subject: [MarkLogic Dev General] Why does xs:boolean(())=()?

Can someone explain why passing this function () returns (), instead of an 
element or throwing an exception?  

declare function local:do-stuff(    
    $bool as xs:boolean
) as element() {
        if ($bool)
        then <x/>
        else <y/>
};

I see that xs:boolean(())=(), but it seems like this should either eval to 
false(), or the function should throw an exception since () isn't a boolean (or 
is it?).  Otherwise, functions with booleans in their signatures can do weird 
things without warning if passed () erroneously.

Thanks,

Will
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to