I want to state that I naively and accidentally experienced this. I was using #name as a temp variable in a class method, representing the name of a file. I did not notice that my anticipated temp variable was not a temporary variable but rather a variable that once assigned to change the name of my class. I corrupted several images with this method before tracking down what was the cause of my corruption. I was not attempting to use #name as a class or instance variable. So this discussion did not come to memory. I just wanted to add my experience to the archives of this list so that others may understand the dangers involved and possibly help with discovery of their problem should they make the same mistake. Jimmie On 8/13/2011 9:39 AM, Lukas Renggli wrote:
Just for fun, try implementing #name on the class-side. Your image is pretty much hosed :-)
Lukas
On 13 August 2011 15:43, Max Leske<maxleske@gmail.com> wrote:
I have. For example:
Implement #name in a couple of classes that form a hierarchy. Since #name is implemented in Object, you might not implement #name in an abstract superclass to send "self subclassResponsibility". Now, if you forget to implement #name in one of the classes in your hierarchy, you don't get a DNU but some cryptic exception since the value you expect from #name is not the one you get.
I know, this isn't really that tragic but I've had it happen to me twice I think and both times I spent a couple of minutes tracking down the problem. Think of the time that is lost if only a couple of us encounter this problem once or twice.
Max
On 12.08.2011, at 19:18, Pat Maddox wrote:
I use #name all over the place and have never had problems.
On Aug 12, 2011, at 9:35 AM, "Sean P. DeNigris"<sean@clipperadams.com> wrote:
How is #name used by the system? I often want to use it in my classes, but I don't want to mess with whatever Object is doing with it. There are +++ senders.
On the flip side, should the system use a different, more specific, intention-revealing selector to avoid this confusion?
Thanks. Sean
-- View this message in context: http://forum.world.st/name-tp3739677p3739677.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.