DIP9 -- Redo toString API
Don
nospam at nospam.com
Sun Nov 21 14:02:07 PST 2010
spir wrote:
> On Sun, 21 Nov 2010 18:21:48 +0100
> Don <nospam at nospam.com> wrote:
>
>> 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,
>
> 1. Please bring concrete cases of apps that do not work well because of toString and would work fine just by replacing it with writeTo.
std.complex. A 3D vector.
In fact, anything that involves floating point.
Performance-wise, anything with a large array. Anything that calculates
lazily. Etc.
> 2. That a given %age of apps suffer of it is not enough reason for privating other of their favorite tool, esp one that is anchored in everyday practice
> 3. Is anyone forced to use toString?
Yes. It's built into the type info of every struct.
> Man, this is simply not fair.
What do you think you will lose?
More information about the Digitalmars-d
mailing list