Re: Substring indices everywhere?
d96-mst@xxxxxx 01 Jan 2000 16:08 UTC
In article <199912312126.VAA11818@fnmoc.navy.mil>, xxxxxx@pobox.com wrote:
>Consider procedures
> string= SMTH1 SMTH2
> string-pad SMTH k [char]
> string-prefix? SMTH1 SMTH2
> string-tokenize SMTH [token-set]
> string->number SMTH [base]
>
>etc.
>SMTH may be a string value. In that case, string= is equivalent to
>R5RS string=?; The meaning of other procedures is obvious. The
>argument list is simple and concise.
>
>However, SMTH may also be a form:
> (XS>< STR BEG-INDEX) or
> (XS>< STR BEG-INDEX END-INDEX)
>where END-INDEX is assumed to be (string-length STR) if omitted.
>Thus we can write:
This does not addess Tom Lords third point, which reads:
* Permitting string indexes everywhere encourages programmers seeking
to write portable code to use string indexes when shared substrings
would be simpler and less error prone. This makes it awkward to
incorporate the code such programmers write into systems which support
shared substrings. Moreover, manipulating string indexes is
notoriously error prone and so should not be a prominent feature of
portable Scheme style.
I think this is a valid point, and I don't agree with your proposal.
If shared substrings are important, why don't we mandate them? I.e. a
Scheme system not supporting shared substrings can't be compliant to
SRFI-13.