one step towards unification of std.algorithm and std.string

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Dec 30 12:00:23 PST 2009


bearophile wrote:
> Andrei Alexandrescu:
>> I'm quite excited about this because it modularizes the entire case 
>> business, opens strings to many algorithms, and allows generalization of 
>> string algorithms.
> 
> It's nice. In my Python code the caseless operations aren't that common. How much common are those in your code?

So and so (e.g. quite some in NLP and a lot in HTML parsing because it 
has case-insensitive tags), but regardless, we can't pretend the need 
doesn't exist.

> Is the nocase leading to a lower performance for some algorithms (like KMP search)?

There are a couple more comparisons per item comparison, so performance 
will be degraded by a constant factor.

>> Well, that is until I hit http://d.puremagic.com/issues/show_bug.cgi?id=3659
> 
> I don't know C++ much, and I have to confess that I have to fully understand the const business still. I hope your book will teach me this topic very well :-)

One thing about const that is slowly downing on this community is that 
it will _not_ be used as often as in C++. It will be rare, and the 
compiler and standard library should not require it without very good 
reason. I think opEquals for classes is at fault for requiring const.


Andrei



More information about the Digitalmars-d mailing list