On 8/17/06, LeVan,Ralph <[log in to unmask]> wrote:
> > -----Original Message-----
> > From: SRU (Search and Retrieve Via URL) Implementors
> [mailto:[log in to unmask]]
> > On Behalf Of Ashley Sanders
> > Funny that, I got the impression that most people preferred
> > zero-based -- I certainly do. I also prefer start:length
> > because as Mike Rylander points out, it is more "standard".
> Just thought I'd throw in my two cents on the "standard"-ness of the
> substring proposal. Java is zero-based and uses beginning and ending
> offset. "dinosaur".substring(1:2) returns "i".
Thanks for that. I still say that's just slice misspelled as
substring, but it's a data point.
> > Sorry, but no. What you're proposing does have negative numbers and a
> > negative numbers is a special case. If it wasn't a special case you
> > wouldn't have felt the need to add "If <length> is negative, ..."
> Speaking of standardness, would someone care to point me at some
> real-world examples of this? I've not run into negative offsets or
> lengths in any of the languages I've learned.
Perl does this, as does Ruby, but I think there's too much confusion
surrounding the details for it to be considered "standard", and there
are other methods for "end of string" matching.
> > If you want a substring that works from the end of the string
> > rather than the beginning have both "substring" and "r_substring".
> > Then you'd have no need of negative numbers and special cases.
> If you need this feature, this proposal would get my vote.
I agree. That, or have a separate 'reverse' modifier that you pile on
top of the standard substring method.
> I'd like to ask a meta-question here. Is anyone going to implement this
> stuff? I've been reluctant to chime in on some of these topics because
> I have neither the ability nor intention of implementing many of the
> things being discussed. I strongly think that we should NOT be adding
> things to the standard that are not going to be broadly implemented. We
> have a good extensibility mechanism and I'd suggest that funky features
> should be profiled and implemented as extensions.
I probably won't implement this soon, but I don't see substring
matching as all that funky, either. I think it's a good idea, just
not that critical.
[log in to unmask]
GPLS -- PINES Development