[xquery-talk] range implementations -- which is correct?

Howard Katz howardk at fatdog.com
Tue Jun 21 23:04:51 PDT 2005


Thanks Michael. 

It would be so wonderfully convenient to be able to use a sequence to define
a positional subrange, but I'm sure we can survive if we have to use the
"position( ) = ..." form. Just another small idiom to remember.
Howard

 > -----Original Message-----
 > From: Michael Rys [mailto:mrys at microsoft.com] 
 > Sent: Tuesday, June 21, 2005 7:52 PM
 > To: Howard Katz; Michael Kay; talk at xquery.com
 > Subject: RE: [xquery-talk] range implementations -- which is correct?
 > 
 > It should be an error since it is easily confusing and 
 > mistaken to mean to give me position() = 1 to 2 while the 
 > general EBV sematics is not that.
 > 
 > Also, the problem is with general atomic sequences and the 
 > necessity to be able to statically determine whether you 
 > have a positional access or a general EBV test which again 
 > is not that simple in the case of sequences (that at runtime 
 > may have more than one item).
 > 
 > Making this an error leaves all these issues outside and 
 > provide us with the option to change it in a future version.
 > 
 > Best regards
 > Michael
 > 
 > > -----Original Message-----
 > > From: talk-bounces at xquery.com [mailto:talk-bounces at xquery.com] On
 > Behalf
 > > Of Howard Katz
 > > Sent: Tuesday, June 21, 2005 3:48 PM
 > > To: 'Michael Kay'; talk at xquery.com
 > > Subject: RE: [xquery-talk] range implementations -- which 
 > is correct?
 > > 
 > > Informative as always. Thank you!
 > > 
 > > Each of the three implementations is indeed correct for
 > > 
 > >    ( <a/>, <b/>, <c/> )[ position() = 1 to 2 ]
 > > 
 > >    => <a/>,  <b/>
 > > 
 > > What's led to the revised view that EBV( atomic-sequence ) is an
 > error?
 > > 
 > > Howard
 > > 
 > >  > -----Original Message-----
 > >  > From: Michael Kay [mailto:mhk at mhk.me.uk]  > Sent: 
 > Tuesday, June 21, 
 > > 2005 3:28 PM  > To: 'Howard Katz'; talk at xquery.com  > Subject: RE: 
 > > [xquery-talk] range implementations -- which is
 > correct?
 > >  >
 > >  > Saxon is correct against the most recent working draft: the  > 
 > > effective boolean value of a sequence of several integers 
 > is  > now an 
 > > error. Before the most recent draft, the EBV of any  > sequence 
 > > containing more than one item was true; so Galax  > was 
 > correct. There 
 > > was a prehistory in which "[1 to 2]" was  > recognized as 
 > some kind of 
 > > custom syntax to extract a  > subsequence - at that stage (1 to 2) 
 > > wasn't a  > general-purpose expression that could be composed with 
 > > other  > expressions - so MarkLogic is reflecting that history.
 > >  > However, this had disappeared from the language before 
 > the  > May 
 > > 2003 draft.
 > >  >
 > >  > Now try the correct syntax in each of the products:
 > >  >
 > >  > ( <a/>, <b/>, <c/> )[ position() = 1 to 2 ]  >  > 
 > Michael Kay  > 
 > > http://www.saxonica.com/  >  > >  > > What's the result of 
 > invoking  > 
 > > >
 > >  > >        ( <a/>, <b/>, <c/> )[ 1 to 2 ]
 > >  > >
 > >  > > ----------------------------
 > >  > >
 > >  > > MarkLogic 3.0 (May 2003 wd) returns  > >
 > >  > >      <a/>
 > >  > >      <b/>
 > >  > >
 > >  > > Galax 0.5.0 (Oct 2004 wd) returns  > >
 > >  > >      <a/>
 > >  > >      <b/>
 > >  > >      <c/>
 > >  > >
 > >  > > Saxon 8.4 (Feb 2005 wd) returns
 > >  > >
 > >  > >    "Error: Effective boolean value is not defined for 
 > a sequence
 > >  > >     of two or more items starting with an atomic value
 > >  > >
 > >  > > The situation is made somewhat more confusing because 
 > each  > > 
 > > implementation is implemented against a different version  
 > > of the 
 > > wd.
 > >  > > More precisely there are two questions:
 > >  > >
 > >  > > (1) Which of the above results are correct (or 
 > incorrect) for the  
 > > > > version of the working draft against which they were  > 
 > > implemented, and  > > (2) Which are correct (or incorrect) 
 > against the 
 > > most  > recent working  > > draft of April 2005?
 > >  > >
 > >  > > Howard
 > >  > >
 > >  > > _______________________________________________
 > >  > > talk at xquery.com
 > >  > > http://xquery.com/mailman/listinfo/talk
 > >  > >
 > >  >
 > > 
 > > _______________________________________________
 > > talk at xquery.com
 > > http://xquery.com/mailman/listinfo/talk
 > 



More information about the talk mailing list