removeSelector:

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

removeSelector:

Benjamin Van Ryseghem (Pharo)
Hello guys,

regarding that comment of SmalltalkImage>>#removeSelector: is 

"Safely remove a selector from a class (or metaclass). If the
class or the method doesn't exist anymore, never mind and
answer nil.
This method should be used instead of 'Class removeSelector:
#method' to omit global class references."

maybe Behavior>>#removeSelector: sould be deprecated ?


Ben
Reply | Threaded
Open this post in threaded view
|

Re: removeSelector:

Stéphane Ducasse

On Nov 23, 2010, at 12:48 PM, Benjamin wrote:

> Hello guys,
>
> regarding that comment of SmalltalkImage>>#removeSelector: is
>
> "Safely remove a selector from a class (or metaclass). If the
> class or the method doesn't exist anymore, never mind and
> answer nil.
> This method should be used instead of 'Class removeSelector:
> #method' to omit global class references."
>
> maybe Behavior>>#removeSelector: sould be deprecated ?

not really

in fact the other one is a hack. I imagine that this is more to make sure you write
Smalltalk removeSelector: #foo instead of MyClass removeSelector: #foo.

I'm not sure that this is used in fact.
Stef


Reply | Threaded
Open this post in threaded view
|

Re: removeSelector:

Benjamin Van Ryseghem (Pharo)

On Nov 23, 2010, at 4:00 PM, Stéphane Ducasse wrote:


On Nov 23, 2010, at 12:48 PM, Benjamin wrote:

Hello guys,

regarding that comment of SmalltalkImage>>#removeSelector: is

"Safely remove a selector from a class (or metaclass). If the
class or the method doesn't exist anymore, never mind and
answer nil.
This method should be used instead of 'Class removeSelector:
#method' to omit global class references."

maybe Behavior>>#removeSelector: sould be deprecated ?

not really

in fact the other one is a hack. I imagine that this is more to make sure you write
Smalltalk removeSelector: #foo instead of MyClass removeSelector: #foo.

I'm not sure that this is used in fact.
Stef


Ok, so maybe we should add a comment in Behavior>>#removeSelector: to precise we should now use SmalltalkImage>>#removeSelector: instead ?

Ben
Reply | Threaded
Open this post in threaded view
|

Re: removeSelector:

Noury Bouraqadi-2
In reply to this post by Benjamin Van Ryseghem (Pharo)
No, it is an ill-named method. The argument is not a selector, but an array. First argument is a class and the second.
 
Noury
On 23 nov. 2010, at 12:48, Benjamin wrote:

> Hello guys,
>
> regarding that comment of SmalltalkImage>>#removeSelector: is
>
> "Safely remove a selector from a class (or metaclass). If the
> class or the method doesn't exist anymore, never mind and
> answer nil.
> This method should be used instead of 'Class removeSelector:
> #method' to omit global class references."
>
> maybe Behavior>>#removeSelector: sould be deprecated ?
>
>
> Ben


Reply | Threaded
Open this post in threaded view
|

Re: removeSelector:

Stéphane Ducasse
In reply to this post by Stéphane Ducasse
>>
>>> Hello guys,
>>>
>>> regarding that comment of SmalltalkImage>>#removeSelector: is
>>>
>>> "Safely remove a selector from a class (or metaclass). If the
>>> class or the method doesn't exist anymore, never mind and
>>> answer nil.
>>> This method should be used instead of 'Class removeSelector:
>>> #method' to omit global class references."
>>>
>>> maybe Behavior>>#removeSelector: sould be deprecated ?
>>
>> not really
>>
>> in fact the other one is a hack. I imagine that this is more to make sure you write
>> Smalltalk removeSelector: #foo instead of MyClass removeSelector: #foo.
>>
>> I'm not sure that this is used in fact.
>> Stef
>>
>
> Ok, so maybe we should add a comment in Behavior>>#removeSelector: to precise we should now use SmalltalkImage>>#removeSelector: instead ?

no we should not use the one of SmalltalkImage.

Stef


Reply | Threaded
Open this post in threaded view
|

Re: removeSelector:

Stéphane Ducasse
In reply to this post by Benjamin Van Ryseghem (Pharo)
We should check who uses it and remove it.
Ben open a ticket please.
BTW there is a pattern Move behavior close to data (and here methods are data so method touching them should be
in Bhevaior and subclasses)
Stef

On Nov 24, 2010, at 8:13 AM, Noury Bouraqadi wrote:

> No, it is an ill-named method. The argument is not a selector, but an array. First argument is a class and the second.
>
> Noury
> On 23 nov. 2010, at 12:48, Benjamin wrote:
>
>> Hello guys,
>>
>> regarding that comment of SmalltalkImage>>#removeSelector: is
>>
>> "Safely remove a selector from a class (or metaclass). If the
>> class or the method doesn't exist anymore, never mind and
>> answer nil.
>> This method should be used instead of 'Class removeSelector:
>> #method' to omit global class references."
>>
>> maybe Behavior>>#removeSelector: sould be deprecated ?
>>
>>
>> Ben
>
>


Reply | Threaded
Open this post in threaded view
|

Re: removeSelector:

Benjamin Van Ryseghem (Pharo)

On Nov 24, 2010, at 2:25 PM, Stéphane Ducasse wrote:

> We should check who uses it and remove it.
> Ben open a ticket please.
> BTW there is a pattern Move behavior close to data (and here methods  
> are data so method touching them should be
> in Bhevaior and subclasses)
> Stef


http://code.google.com/p/pharo/issues/detail?id=3286


Ben