D - No toString() for built in types?
- Matthew (6/6) Jan 05 2004 I'd like to be able to call toString() as a member for built-in types, a...
- J Anderson (4/11) Jan 05 2004 A work around (as I suggested before for inclusion in the std lib) is to...
- Matthew (5/21) Jan 05 2004 Sure. We can use shims, but shims are (in my own little world at least -
- C (4/10) Jan 05 2004 Seconded , I think this little bit will go a long way for the language.
I'd like to be able to call toString() as a member for built-in types, as in: int i; printf("%.*s\n", i.toString()); That way I can write generic code that will work for built-ins and Object derived ones.
Jan 05 2004
Matthew wrote:I'd like to be able to call toString() as a member for built-in types, as in: int i; printf("%.*s\n", i.toString()); That way I can write generic code that will work for built-ins and Object derived ones.A work around (as I suggested before for inclusion in the std lib) is to wrap the toString calls in functions. But I think you already know that. Anderson
Jan 05 2004
Matthew wrote:Sure. We can use shims, but shims are (in my own little world at least - http://www.cuj.com/documents/s=8681/cuj0308wilson/) in large part a fix for C++'s inadequacies. I've no doubt they'll feature in D to a significant extent, but anywhere we can do without is a boon to readability, even if it makes no difference to performance and expressiveness.I'd like to be able to call toString() as a member for built-in types, as in: int i; printf("%.*s\n", i.toString()); That way I can write generic code that will work for built-ins and Object derived ones.A work around (as I suggested before for inclusion in the std lib) is to wrap the toString calls in functions. But I think you already know that.
Jan 05 2004
Seconded , I think this little bit will go a long way for the language. C "Matthew" <matthew.hat stlsoft.dot.org> wrote in message news:btbpjq$2fa1$1 digitaldaemon.com...I'd like to be able to call toString() as a member for built-in types, as in: int i; printf("%.*s\n", i.toString()); That way I can write generic code that will work for built-ins and Object derived ones.
Jan 05 2004