digitalmars.D - Feature request: writefln to call toString() on objects?
Consider the following: Wouldn't it be more natural for writefln to call the object's toString member? (Is it even possible?) Nick
Aug 12 2004
Nick wrote:Consider the following: Wouldn't it be more natural for writefln to call the object's toString member? (Is it even possible?)that's the way it's meant to be working. it's even in the format func, well partially. It doesn't work because typeinfo's are still broken. as soon as they are fixed, your example will work perfectly :]
Aug 12 2004
In article <cfgd62$2flg$1 digitaldaemon.com>, Nick says...Consider the following: Wouldn't it be more natural for writefln to call the object's toString member? (Is it even possible?) Nickit's suppose to do that, it's just broken, check the bugs group. Ant http://www.digitalmars.com/d/std_format.html#format-string FormatChar 's' The corresponding argument is formatted in a manner consistent with its type: [...] classes derived from Object The result is the string returned from the class instance's .toString() method. A Precision specifies the maximum number of characters to use in the result.
Aug 12 2004