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

RE: subsequence and item-at

From: Kay, Michael <Michael.Kay@softwareag.com>
Date: Mon, 20 Jan 2003 16:50:53 +0100
Message-ID: <DFF2AC9E3583D511A21F0008C7E621060453DF82@daemsg02.software-ag.de>
To: Oliver Becker <obecker@informatik.hu-berlin.de>, public-qt-comments@w3.org

> concerning the subsequence function I would suggest to 
> specify it similary to substring. This would be consistent 
> and answer such questions like "what if $startingLoc is negative" etc.

I agree that this is worth looking at. Generally the style for newer
functions has been to report errors for "unreasonable" arguments rather than
to fallback, but this needs to be balanced against the need for consistency.
> 
> Additionally, item-at($seq, $pos) should IMO return the same 
> as subsequence($seq, $pos, 1) i.e. instead of raising an 
> error "Invalid position" this function would return the empty 
> sequence if $pos is out of bounds. This poses the question if 
> item-at is necessary at all, since subsequence($seq, $pos, 1) 
> would do the task.
> 

The advantage of item-at() over subsequence() and $seq[$pos] is mainly for
people interested in static type checking: item-at() is the only one of
these that guarantees statically to return exactly one item in the result.

Michael Kay
Received on Monday, 20 January 2003 10:50:58 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:14:23 GMT