#name

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

#name

Sean P. DeNigris
Administrator
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
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: #name

Max Leske
+ 1


On 12.08.2011, at 17:35, Sean P. DeNigris 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.
>


Reply | Threaded
Open this post in threaded view
|

Re: #name

patmaddox
In reply to this post by Sean P. DeNigris
I use #name all over the place and have never had problems.



On Aug 12, 2011, at 9:35 AM, "Sean P. DeNigris" <[hidden email]> 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.
>

Reply | Threaded
Open this post in threaded view
|

Re: #name

Stéphane Ducasse
In reply to this post by Sean P. DeNigris

On Aug 12, 2011, at 5:35 PM, Sean P. DeNigris 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.


Yes
name is object is quite a bad smell to me.
This is on my radar to nule setname: and friends. Since this is only used to give name to part in etoyish morphic

If I remember also pay attention for class methods too.

> 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.
>


Reply | Threaded
Open this post in threaded view
|

Re: #name

Max Leske
In reply to this post by patmaddox
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" <[hidden email]> 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.
>>
>


Reply | Threaded
Open this post in threaded view
|

Re: #name

Lukas Renggli
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 <[hidden email]> 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" <[hidden email]> 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.
>>>
>>
>
>
>



--
Lukas Renggli
www.lukas-renggli.ch

Reply | Threaded
Open this post in threaded view
|

Re: #name

Stéphane Ducasse

On Aug 13, 2011, at 4:39 PM, Lukas Renggli wrote:

> Just for fun, try implementing #name on the class-side. Your image is
> pretty much hosed :-)

Yes this was what I was thinking.

Stef



Reply | Threaded
Open this post in threaded view
|

Re: #name

laza
In reply to this post by Lukas Renggli
2011/8/13 Lukas Renggli <[hidden email]>
Just for fun, try implementing #name on the class-side. Your image is
pretty much hosed :-)

I guess that depends on what that name method does return, no? If it's a String or Symbol it looks funny, but the image doesn't seem to be hosed. :)

Alex

bullfrog.png (69K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: #name

Stéphane Ducasse
Do you really get that ?
        :)

Stef

On Aug 13, 2011, at 5:15 PM, Alexander Lazarević wrote:

> 2011/8/13 Lukas Renggli <[hidden email]>
> Just for fun, try implementing #name on the class-side. Your image is
> pretty much hosed :-)
>
> I guess that depends on what that name method does return, no? If it's a String or Symbol it looks funny, but the image doesn't seem to be hosed. :)
>
> Alex
> <bullfrog.png>


Reply | Threaded
Open this post in threaded view
|

Re: #name

ccrraaiigg
In reply to this post by Sean P. DeNigris

Hi Sean--

> 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.

     And several implementers that could be using more descriptive
selectors, too, which makes answering the question harder, of course.

> On the flip side, should the system use a different, more specific,
> intention-revealing selector to avoid this confusion?

     Certainly. From my work with minimal systems (which includes
logging many specific send-sites), I'm convinced that this behavior
should have a more descriptive selector, and is not essential to Object
anyway.


-C

--
Craig Latta
www.netjam.org/resume
+31   6 2757 7177
+ 1 415  287 3547



Reply | Threaded
Open this post in threaded view
|

Re: #name

Schwab,Wilhelm K
In reply to this post by Stéphane Ducasse
I looked at this early on, and decided that since Object>>name is defined in terns of #printString, there couldn't be anything terribly important happening with the result, because #printSring is not under the system's control.  I have freely added name as an instance variable in many classes.

Process>>name and #name: are interesting.  I didn't do the hash part, but I advocated for adding the name aspect to Process, and was very much surprised to see it adopted.  This was in the days when most requests for changes prompted a reply something like "Do you realize that YOU can do that to YOUR image?" - emphasis added, but it was always clearly present.

However, it has apparently been there since 2002.  If there were going to be problems, I think we would have seen them by now :)  That of course does nothing to fix the real problem, but I think it does provide evidence that one can safely ignore Object>>name.

Bill


________________________________________
From: [hidden email] [[hidden email]] On Behalf Of Stéphane Ducasse [[hidden email]]
Sent: Saturday, August 13, 2011 9:39 AM
To: [hidden email]
Subject: Re: [Pharo-project] #name

On Aug 12, 2011, at 5:35 PM, Sean P. DeNigris 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.


Yes
name is object is quite a bad smell to me.
This is on my radar to nule setname: and friends. Since this is only used to give name to part in etoyish morphic

If I remember also pay attention for class methods too.

> 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.
>



Reply | Threaded
Open this post in threaded view
|

Re: #name

Jimmie Houchin-5
In reply to this post by Lukas Renggli
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<[hidden email]>  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"<[hidden email]>  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.
>>>>
>>>
>>
>>
>>
>
>
>