Regarding std.array.Appender

bearophile bearophileHUGS at lycos.com
Wed Feb 29 18:23:54 PST 2012


Jonathan M Davis:

> > put is a function on output ranges, and Appender is an output range.
> 
> Also, given that it doesn't define ~ (and it wouldn't really make sense for it 
> to), it would be very weird IMHO to define ~=.

I don't understand why that's weird.
In Java you can't overload an append operator, so using a method is right. But for me it's weird that Appender doesn't use the D operator to _append_. I sometimes use "add" instead of "put" by mistake, forgetting the right method name, because I find it quite unnatural. If Appender needs a put, then I suggest to give it both "put" method and "~=" operator.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list