[Top][All Lists]

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

Re: [Chicken-hackers] substring

From: Mario Domenech Goulart
Subject: Re: [Chicken-hackers] substring
Date: Fri, 26 Aug 2016 18:36:01 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)


On Fri, 26 Aug 2016 16:47:11 +0200 address@hidden wrote:

>> Out of curiosity: any example where substring=? would be useful in
>> practice?
> Grep the egg repo, you will find some uses.

As far as I can see, two out of 733 eggs use substring=? (readline and
pathfinder).  A total of five calls.

All of them, except for a suspicious one in readline, require the use of
string-length.  In one of the cases, string-length is applied twice on
the same input.

> But generally speaking, it's somewhat difficult to come up with a
> metric of usefulness - the danger being (as always) being blinded by
> our own limited experience.


I'm not proposing doing anything with substring=?.  The discussion
came up when I wrongly used substring=? in my code and thought it was
a bug.  After reading and reflecting on what the documentation says, I
understand that substring=? is not buggy (although I still think it is
a bit convoluted).

> Having a substring comparison is somwhat orthogonal to substring
> extraction and not having to allocate an intermediate string just to
> compare (say) two fields may save some bytes. Not necessarily in all
> implementations, but in a sufficiently smart one...

Agreed again.

All the best.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]