[Pharo-project] Time to rename Object>>#name ?
Hi guys, Isn't a time come to finally rename this unfortunate method #name in Object to something more internal? From its comment it seems it is using just for debugging: Object>>name "Answer a name for the receiver. This is used generically in the title of certain inspectors, such as the referred-to inspector, and specificially by various subsystems. By default, we let the object just print itself out.. " ^self printString I namely just crashed my image and spend quite some time to find why, by implementing: MyClass>>printString ^'aMyClass', self name Later I renamed #name to say #myName but forgot to rename a call in this #printString method too. Boom, infinite recursion! Please allow us therefore to use #name in our classes for things a word "name" is meant! Best regards Janko -- Janko Mivšek Aida/Web Smalltalk Web Application Server http://www.aidaweb.si
Hi guys,
Isn't a time come to finally rename this unfortunate method #name in Object to something more internal? From its comment it seems it is using just for debugging:
Object>>name "Answer a name for the receiver. This is used generically in the title of certain inspectors, such as the referred-to inspector, and specificially by various subsystems. By default, we let the object just print itself out.. "
^self printString
I namely just crashed my image and spend quite some time to find why, by implementing:
MyClass>>printString
^'aMyClass', self name
Later I renamed #name to say #myName but forgot to rename a call in this #printString method too. Boom, infinite recursion!
Please allow us therefore to use #name in our classes for things a word "name" is meant!
We would love but this is not that easy. Stef
Best regards Janko
-- Janko Mivšek Aida/Web Smalltalk Web Application Server http://www.aidaweb.si
On Sat, 17 Dec 2011, Janko Mivšek wrote:
Hi guys,
Isn't a time come to finally rename this unfortunate method #name in Object to something more internal? From its comment it seems it is using just for debugging:
Object>>name "Answer a name for the receiver. This is used generically in the title of certain inspectors, such as the referred-to inspector, and specificially by various subsystems. By default, we let the object just print itself out.. "
^self printString
I namely just crashed my image and spend quite some time to find why, by implementing:
MyClass>>printString
^'aMyClass', self name
You should almost never override #printString. If you want to change the printString of an object, then you should override #printOn:. Levente
Later I renamed #name to say #myName but forgot to rename a call in this #printString method too. Boom, infinite recursion!
Please allow us therefore to use #name in our classes for things a word "name" is meant!
Best regards Janko
-- Janko Mivšek Aida/Web Smalltalk Web Application Server http://www.aidaweb.si
participants (3)
-
Janko Mivšek -
Levente Uzonyi -
Stéphane Ducasse