toString refactor in druntime
Steven Schveighoffer via Digitalmars-d
digitalmars-d at puremagic.com
Mon Nov 3 14:33:25 PST 2014
On 11/3/14 4:40 PM, Walter Bright wrote:
> On 11/3/2014 8:09 AM, Steven Schveighoffer wrote:
>> It is a huge difference to say EVERYONE who implements toString will
>> take any
>> templated type that purports to be an output range, vs giving one case
>> to handle.
>
> All an output range is is a type with a 'put' method. That's it. You're
> making it out to be far more complex than it is.
>
Directly from the docs:
(http://dlang.org/phobos/std_range.html#isOutputRange)
void myprint(in char[] s) { }
static assert(isOutputRange!(typeof(&myprint), char));
No 'put' in sight, except as a substring of isOutputRange.
I don't think you realize what a beast supporting all output ranges is,
or using them (hint: calling r.put for a generic output range is an ERROR).
-Steve
More information about the Digitalmars-d
mailing list