[phobos] bug in map
andrei at erdani.com
Mon Aug 6 11:55:56 PDT 2012
auto s = "some string";
auto m = map!(a => a)(s);
Both asserts should pass: string famously has a length that's actually
not the length of the range. Then mapping something on top of the string
should also have no meaningful length. Alas, it does, because of the
following code in std.algorithm:
static if (hasLength!R || isSomeString!R)
@property auto length()
alias length opDollar;
The code used to introduce length only if if (hasLength!R).
It seems Kenji introduced this change. What was its purpose, and can we
undo it? This breaks the entire web of assumptions that hasLength builds.
More information about the phobos