On Thursday, 6 March 2014 at 21:26:45 UTC, Walter Bright wrote:
A major goal for D in the short term is to reduce reliance in
Phobos on the GC. I was looking at std.string last night, and I
noticed a couple things:
1. The inputs are constrained to being strings. This is overly
restrictive, the inputs should be InputRanges.
2. The outputs should be a range, too. In fact, the string
functions should become algorithms. Then they won't need to
allocate any memory at all.
The existing functions should not be removed, but perhaps
rewritten as wrappers around the algorithm versions.
I've found that rewriting traditional code, which is what
std.string is now, in terms of algorithms is a bit
mind-bending. But it's well worth it, and fun.
So who wants to step up? Don't have to do the whole thing in
one go, just pick a function and do that one.
Seems like a good idea to reduce memory usage wherever possible,
but I thought that the reason std.string exists (and duplicates
some functionality that exists elsewhere) is to provide
string-specific versions that were either optimized specifically
for strings, or have completely different functionality due to
working with strings.