DIP9 -- Redo toString API

Don nospam at nospam.com
Sun Nov 21 09:21:48 PST 2010


spir wrote:
> On Sun, 21 Nov 2010 03:17:57 -0800
> Jonathan M Davis <jmdavisProg at gmx.com> wrote:
> 
>> You're not losing _anything_ out of the deal except that you wouldn't do 
>> obj.toString(). Instead you'd do to!string(obj).
> 
> I'm usually not using toString(), it's supported by the language. What about format("%s:%s", a,b)? Will it still call toString implicitely, or writeTo a buffer, or what else?
> 
> Anyway, I cannot see any advantage in deprecating toString() for every programmer in every use case, just for hypothetical efficiency issues

The efficiency issues are important, but are not the primary motivation.
toString() is just wrong. The idea that there is ONE AND ONLY ONE 
textual representation of an object, is, frankly, idiotic.




More information about the Digitalmars-d mailing list