Eugen Wissner
0c8f1eb4ce
An output range for E won't be automatically an output range for [E] anymore. The same, an output range for [E] won't be automatically an output range for E. Automatic E <-> [E] conversion seems to be a nice feature at first glance, but it causes much ambiguity. 1) If I want that my output range accepts only UTF-8 strings but not single characters (because it could be only part of a code point and look like broken UTF-8 without the remaining code units), I can't do it because an OutputRange(R, E) can't distinguish between char and string. 2) Here is an example from 2013: import std.range; import std.stdio; Appender!(const(char)[][]) app; put(app, "aasdf"); put(app, 'b'); writeln(app.data); This outputs: ["aasdf", "\0"]. Whether it is a common case or not, such code just shouldn't compile. |
||
---|---|---|
.. | ||
tanya |