[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Substring indices everywhere?

This page is part of the web mail archives of SRFI 13 from before July 7th, 2015. The new archives for SRFI 13 contain all messages, not just those from before July 7th, 2015.



In article <199912312126.VAA11818@xxxxxxxxxxxxxx>, oleg@xxxxxxxxx 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.