[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: () eq () vs () = ()

Subject: Re: () eq () vs () = ()
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Fri, 30 Sep 2011 09:39:05 -0400
Re:  () eq () vs () = ()
At 2011-09-30 14:28 +0100, Andrew Welch wrote:
>> If () = () is false, then it's intuitive (to me) that deep-equal((),
>> ()) is also false.  The one liner saying that it should be true just
>> seems like it could easily say false.
>
> No, that would be wrong/confusing. deep-equal returns true because the
> sequences are the same, = returns false because no items in either sequence
> are equal.

To parapharse:

The sequences are the *same*, but no items in either sequence are equal.

Ok, that takes a little pondering, but I can get that.

So, now that () and () are the same, why does () eq () not return true?

Because eq is in the set of "value comparisons" and there are no values to operate on, thus, no items in either sequence are equal. Functions 3.5.1 says "Value comparisons are used for comparing single values".


Note that you ask "why not true()?", but the return from eq with an empty sequence operand isn't false(). Rather it is () as if to say "there are no comparisons returned from this expression". Converting that to Boolean is false(), but the return itself isn't false(). You only get a true() if there are two singletons and they compare equal. You are getting a non-empty result: a sequence of one value of true(). With either operand as the empty set you are getting a value comparison response of "no response" with (). An empty response.

I think David said it the best and wish I'd thought of saying it that way myself!

. . . . . . . . Ken


-- Contact us for world-wide XML consulting and instructor-led training Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Google+ profile: https://plus.google.com/116832879756988317389/about Legal business disclaimers: http://www.CraneSoftwrights.com/legal

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.