std.string and std.algorithm: what to do?
steve.teale at britseyeview.com
Thu May 14 09:31:23 PDT 2009
Andrei Alexandrescu Wrote:
> dsimcha wrote:
> > == Quote from Andrei Alexandrescu (SeeWebsiteForEmail at erdani.org)'s article
> >> I'm not sure what needs to be done about the combo string + algorithm.
> >> There's quite some overlap, and also functions that have the same name
> >> in both modules (e.g. find()), which forces you to disambiguate.
> >> Should std.algorithm automatically recognize strings and proceed
> >> accordingly, should it just consider them straight arrays and leave
> >> everything else to std.string (risky!), or refuse to handle strings?
> > I like the idea of automatically specializing on strings, at least on the surface.
> > It's less to remember for the programmer, less annoying naming collisions, and
> > stuff "just works". You get your generic std.algorithm stuff when you need it and
> > your more optimized/variable length character encoding stuff when you need it
> > without having to explicitly specify which one you want.
> Cool! So then how do I rename find, ifind, rfind, and irfind in std.string?
Maybe you should rename the new stuff - indexOf, etc. Why break existing code that works with D1 and D2 and tests for -1. I think that find may be a rather widely used function.
More information about the Digitalmars-d