Is all this Invarient **** er... stuff, premature optimisation?

Janice Caron caron800 at googlemail.com
Mon Apr 28 09:59:16 PDT 2008


On 28/04/2008, Me Here <p9e883002 at sneakemail.com> wrote:
> Ah! Again, 3 lines instead of 1. Plus two function calls and a temporary variable.

To be fair though, the problem here is that the functions you are
calling (std.string.toupper and std.string.tolower) don't do what you
want. This is not a fault of the language - it's a limitation of the
library.

To that end, as others have said, this problem could be solved simply
enough by the addition of another module - say, std.stringbuffer - in
which we alias char[] to stringbuffer (or maybe a StringBuffer class -
I'm not sure what's best) and provide a whole bunch of functions
optimized for those mutable char arrays.

To blame the language for the lack of library is the wrong approach.
D2 has some killer, kickass features. The template metaprogramming
power alone is enough to make C++ programmers weep. I'm looking
forward to pure functions, and a new generation of multithreading.

If there's enough interest, and if Walter approves, I could certainly
kickstart std.stringbuffer. Is that the right way to go? What do
people think?



More information about the Digitalmars-d mailing list