std.string and std.algorithm: what to do?

Michiel Helvensteijn m.helvensteijn.remove at gmail.com
Thu May 14 12:10:12 PDT 2009


Andrei Alexandrescu wrote:

> 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?

You gave me an idea there. Perhaps hierarchical modules are a bit outdated?
Perhaps a modern programming language should instead work with a system of
tags, since a function/class/entity may belong to more than one group.

I too hate making a decision like that. So don't.

Your std.string.find() may carry the `algorithm' tag and the `string' tag.
So perhaps if both (or either?) of those tags are imported into a project,
the function would become available.

-- 
Michiel Helvensteijn




More information about the Digitalmars-d mailing list