SRFI 140 draft 6 minor comments
Sudarshan S Chawathe 01 May 2017 22:56 UTC
Re. Draft #6 published: 2017/4/25:
I am still working on trying out some of the implemented parts in Kawa,
but in the meanwhile here are some quick comments, all very minor, and
one question.
* Minor comments
- I like the current choice of "istring" as a name for immutable
strings (and likewise "mstring" for mutable ones).
- The reason given for including an mstring? predicate seems like a
very good one to me.
- For string-index and friends, I like the SRFI-13-like option of
providing a character or character set in lieu of the predicate,
mainly because I assume/hope (perhaps falsely) that an
implementation may work faster for the special cases. (It's a bit
more convenient to the user too, but I doubt that would be reason
enough.)
- Regarding xsubstring:
- naming: +1 vote for using xsubstring for conciseness and
compatibility with SRFI-13.
- Default value of 'to' parameter of xsubstring: I like the idea
of sticking with the SRFI-13 default of from+(end-start).
- I also like the proposed extended interpretation when 'to' is
both negative and less than 'from'.
- Typos, etc.
- string-pad: return value should be istring, not text.
- There are a few instances of "stri" that should read "srfi".
- 3rd para under "Kawa's implementation of istring": "implified"
* Question
- Is there any benefit (efficiency of implementation) to having a
way to indicate (optionally) that a string read from a port
(using, say, read-line) be immutable? I am thinking here of a
program that reads lines from a text file, classifying them based
on some simple searches (using string-index, etc.). There is no
need for mutation, so the performance guarantees provided by
istrings are attractive. Or would something like
(string-repeat (read-line) 1)
be sufficient to get all the likely performance benefits? (I
suspect the "line" would likely need to be quite long for the
benefits to matter, but we could think of an example with
larger non-line text chunks read from a port too.)
Regards,
-chaw