Hi,

On Fri, 26 Aug 2016 16:47:11 +0200 felix.winkelm...@bevuta.com 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.

Agreed.

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.
Mario
-- 
http://parenteses.org/mario

_______________________________________________
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers

Reply via email to