#name

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

#name

Ben Coman
What is the purpose of the #name method in the system?
How integral/important is this method and what are the dangers of
overriding it?

I am getting tired of auto creating accessors and getting a #name1
method due to a clash that I happened to very commonly have 'name' as an
instance variable.  I have so far been changing my 'name' instance
variables to 'myName' to avoid the clash because I am not comfortable
with my understanding of how it ties in - but its time I tried harder to
understand.

cheers -ben


Reply | Threaded
Open this post in threaded view
|

Re: #name

mmimica
On 13 January 2013 10:13, Ben Coman <[hidden email]> wrote:
What is the purpose of the #name method in the system?
How integral/important is this method and what are the dangers of overriding it?

On instance side, I think you can override it with no harm. You will have that object's name displayed in Inspector and other places - but that's fine, afterall that is that object's name.


--
Milan Mimica
http://sparklet.sf.net
Reply | Threaded
Open this post in threaded view
|

Re: #name

Stéphane Ducasse
In reply to this post by Ben Coman

On Jan 13, 2013, at 10:13 AM, Ben Coman wrote:

> What is the purpose of the #name method in the system?

It was because in etoy you can give a name to anything…. I would love to remove.
> How integral/important is this method and what are the dangers of overriding it?
On class I guess that it is dangerous

> I am getting tired of auto creating accessors and getting a #name1 method due to a clash that I happened to very commonly have 'name' as an instance variable.  I have so far been changing my 'name' instance variables to 'myName' to avoid the clash because I am not comfortable with my understanding of how it ties in - but its time I tried harder to understand.

Welcome to the club
One day we will address it just that we have not enough fingers and brains.

>
> cheers -ben
>
>


Reply | Threaded
Open this post in threaded view
|

Re: #name

LogiqueWerks
Having the option to use #name proves very useful in the Curl language for tagging objects - usually #clientFirstName #clientLastName etc. prevent any issues ( I rank the "my" of #myName with "this" - for which we already have "self" ! :-) ).

Does anyone else find it useful to know that you will be able to tag an object ?

Should #name in LookupKey be #keyString ?   FileStream   #fileName ??

Only Exception uses #tag ??

#nameTag  ??

I think that in the base Pharo 1.4 there are no senders of #tag or #tag:  so that looks like a nice option

But a "name" String should be avoided as an identifier slot for an instance object's identity, right ?



On 13 January 2013 05:52, Stéphane Ducasse <[hidden email]> wrote:

On Jan 13, 2013, at 10:13 AM, Ben Coman wrote:

> What is the purpose of the #name method in the system?

It was because in etoy you can give a name to anything…. I would love to remove.
> How integral/important is this method and what are the dangers of overriding it?
On class I guess that it is dangerous

> I am getting tired of auto creating accessors and getting a #name1 method due to a clash that I happened to very commonly have 'name' as an instance variable.  I have so far been changing my 'name' instance variables to 'myName' to avoid the clash because I am not comfortable with my understanding of how it ties in - but its time I tried harder to understand.

Welcome to the club
One day we will address it just that we have not enough fingers and brains.

>
> cheers -ben
>
>