DIP9 -- Redo toString API

Fawzi Mohamed fawzi at gmx.ch
Fri Nov 19 02:36:22 PST 2010


On 19-nov-10, at 10:22, Jacob Carlborg wrote:

> On 2010-11-18 23:21, Steven Schveighoffer wrote:
>>
>> I just created a new D Improvement Proposal to fix the toString  
>> problem
>> I brought up several posts ago.
>>
>> See: http://prowiki.org/wiki4d/wiki.cgi?LanguageDevel/DIPs/DIP9
>>
>> -Steve
>
> Why do we have to remove toString, can't toString call writeTo and  
> behave as it does now?

that is what I do in blip.
toString by default is

char[] toString(){
	return collectAppender(&desc);
}

I called the method desc because I saw it as description of the object.

and if the object implements serialization then the description if  
just a serialization to json format (both of those are added by mixin  
printOut!();



More information about the Digitalmars-d mailing list