3 ms·
I agree that a class designer need not suppose that "the string representation he implements should be the canonical representation of that class," however if y
by raganwald 16y ago
I agree that a class designer need not suppose that "the string representation he implements should be the canonical representation of that class," however if you take that line, you should not suppose that any class ought to know how to convert itself to another class. If phone numbers shouldn't know their canonical representation as strings, then why should circles know their canonical representation as ellipses?
Perhaps, as you suggest, this is a function that should be external to the instances. But I repeat myself:
http://weblog.raganwald.com/2007/10/too-much-of-good-thing-not-all.html http://weblog.raganwald.com/2007/10/too-much-of-good-thing-n...