Issue 3957 in pharo: MethodWrappers left method after uninstall

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

Issue 3957 in pharo: MethodWrappers left method after uninstall

pharo
Status: New
Owner: ----

New issue 3957 by [hidden email]: MethodWrappers left method after  
uninstall
http://code.google.com/p/pharo/issues/detail?id=3957

Pharo image: Pharo 1.2.1 Latest update: #12345
Virtual machine used:  'Croquet Closure Stack VM [StackInterpreter  
VMMaker-oscog-IgorStasenko.54]'
Class browser used (if applicable): OB
Steps to reproduce:
1. create a new class, example Foo
2. install a method wrapper on Foo, on a selector non defined locally.
3. uninstall the method wrapper.
4. now you have the method defined locally, with the inherited behavior.
Example:
| a |
a := ObjectAsMethodWrapper on: Foo selector: #hash.
a install.
a uninstall.

Now you have a hash method on Foo, that should not be there.
One solution is to add something like this to the install code:
(self wrappedClass localSelectors includes: self selector)
                ifTrue: [needCleanUp := false.]
                ifFalse: [needCleanUp := true].

And this to the uninstall code:
needCleanUp ifTrue: [self wrappedClass removeSelector: self selector]



Reply | Threaded
Open this post in threaded view
|

Re: Issue 3957 in pharo: MethodWrappers left method after uninstall

pharo

Comment #1 on issue 3957 by marianopeck: MethodWrappers left method after  
uninstall
http://code.google.com/p/pharo/issues/detail?id=3957

Thinking about that, I think that's a bug. I mean, you want to install the  
wrapper in the class Foo. For me, it should not follow the lookup. It  
should do just a

oldMethod := self wrappedClass methodDict at: self selector

which will throw an error if the selector is not defined in the class.

I think that doing the lookup can be dangerous. Maybe adding another method  
like:

ObjectAsMethodWrapper onClassOrSuperclasses: Foo selector: #hash

that does what is now...

what do you think ?


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3957 in pharo: MethodWrappers left method after uninstall

pharo

Comment #2 on issue 3957 by [hidden email]: MethodWrappers left method  
after uninstall
http://code.google.com/p/pharo/issues/detail?id=3957

I think that's ok to follow the lookup, because the inherited selectors are  
part of the behavior of the class, but i think it's a good idea to have a  
form to restrict that.
Anyway, in any of the two cases, after the uninstall process, the class  
should be clean
Greetings,
   Daniel.


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3957 in pharo: MethodWrappers left method after uninstall

pharo
Updates:
        Status: Accepted

Comment #3 on issue 3957 by marianopeck: MethodWrappers left method after  
uninstall
http://code.google.com/p/pharo/issues/detail?id=3957

"I think that's ok to follow the lookup, because the inherited selectors  
are part of the behavior of the class, but i think it's a good idea to have  
a form to restrict that."

yes, because the user can do a mess with that. The easiest way is to trhow  
an error. Then the user can always do the method lookup by himself and do a  
installOn: with the correct class and selector.


"Anyway, in any of the two cases, after the uninstall process, the class  
should be clean"

I agree. I will try to provide a solution (taking int account yours). I  
will let you know.

Daniel...BTW, which is your particular use for MethodWrappers? I mean, why  
are you using them for? I am just curious...


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3957 in pharo: MethodWrappers left method after uninstall

pharo

Comment #4 on issue 3957 by [hidden email]: MethodWrappers left method  
after uninstall
http://code.google.com/p/pharo/issues/detail?id=3957

jajaja, I'm developing a aspect oriented language for Pharo, using method  
wrappers as a first implementation approach.


Reply | Threaded
Open this post in threaded view
|

Pharo 1.2.1 Problems with OpenGL

CdAB63
In Pharo 1.2.1 it's not possible to intall OpenGL (yeah, I know, quite
old code). Lots of syntax errors during install.

It works in Pharo 1.1.1

Reply | Threaded
Open this post in threaded view
|

Re: Pharo 1.2.1 Problems with OpenGL

Mariano Martinez Peck
Give people more information. Which sintax error?  attach logs o screenshots

On Wed, Apr 6, 2011 at 1:10 AM, Casimiro de Almeida Barreto <[hidden email]> wrote:
In Pharo 1.2.1 it's not possible to intall OpenGL (yeah, I know, quite
old code). Lots of syntax errors during install.

It works in Pharo 1.1.1




--
Mariano
http://marianopeck.wordpress.com

Reply | Threaded
Open this post in threaded view
|

Re: Pharo 1.2.1 Problems with OpenGL

CdAB63
Em 06-04-2011 04:46, Mariano Martinez Peck escreveu:
Give people more information. Which sintax error?  attach logs o screenshots
Mine syntax error... Trully.

When I tried to build a configuration roadmap that can be reproduced by students I failed to remember that it's not possible to use the Monticello version of OpenGL anymore. It's necessary to use a debugged version provided by Javier Pimas (which I include here as an annex).

Anyways I suggest that either Javier version is uploaded into Metacello repository or a pointer to the file is provided & the Collaborative Book is corrected in this respect.

Best regards,

Casimiro Barreto

PS: Pharo 1.2 just looks great.

On Wed, Apr 6, 2011 at 1:10 AM, Casimiro de Almeida Barreto <[hidden email]> wrote:
In Pharo 1.2.1 it's not possible to intall OpenGL (yeah, I know, quite
old code). Lots of syntax errors during install.

It works in Pharo 1.1.1




--
Mariano
http://marianopeck.wordpress.com



OpenGL-JavierPimas.1.mcz (158K) Download Attachment