Added Instance Variables and Methods are not shown in System Browser

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

Added Instance Variables and Methods are not shown in System Browser

Warakorn Paphrawat
I developed a little Meta-Programming application, which adds methods to the MethodDictionary of a class and adds instance variables + getters/setters.

However, after running this application the changes are not reflected in the System Browser.
All new instance variables and new methods are not shown there.
On the other side I can run a little test application, which creates a new instance of class (to which I added some methods and variables), which in turn uses some of the added methods and instance variables through getters/setters without any errors.

Is there any trick to make these added methods and instance variables visible ?
Again, the new methods are correctly integrated into the MethodDictionary with selectors and CompiledMethods according to "aClass inspect".
Is there another way to check whether the new methods and new instance are really integrated into a new class?

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners

Reply | Threaded
Open this post in threaded view
|

Re: Added Instance Variables and Methods are not shown in System Browser

Roel Wuyts
It is possible that you added the class to the method dictionary, but  
not to the categories. When adding a new method to a class there is  
actually two different things to be done:
- adding the method to the method dictionary
- adding the protocol information to the category attached to each  
class. That is basically a dictionary that says which category  
contains what selectors.

Now it all depends on how you implemented your application. When  
using the proper meta-level operation to add a method to a class in a  
certain category, both happen and everything should be ok. Even  
better, open browsers will refresh and should show your newly added  
method.

But from your description I think that you used some other (deeper,  
more fine-grained and fundamental) parts of the meta-level, namely  
the part that only adds the method to the method dictionary. As a  
result your class knows about the method, but your category does not  
(and this is used by the browser). That would explain why you can  
send the corresponding message and see the method in the inspector,  
but not in the browser.

A good starting point to see what happens is in the various kinds of  
#compile:classified methods on Parser or Compiler (sorry, I do not  
have a Squeak on the machine at hand; ping me for specific info and I  
can send you the exact names of all methods involved).

On 07 Jan 2007, at 17:54, Warakorn Paphrawat wrote:

> I developed a little Meta-Programming application, which adds  
> methods to the MethodDictionary of a class and adds instance  
> variables + getters/setters.
>
> However, after running this application the changes are not  
> reflected in the System Browser.
> All new instance variables and new methods are not shown there.
> On the other side I can run a little test application, which  
> creates a new instance of class (to which I added some methods and  
> variables), which in turn uses some of the added methods and  
> instance variables through getters/setters without any errors.
>
> Is there any trick to make these added methods and instance  
> variables visible ?
> Again, the new methods are correctly integrated into the  
> MethodDictionary with selectors and CompiledMethods according to  
> "aClass inspect".
> Is there another way to check whether the new methods and new  
> instance are really integrated into a new class?
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Added Instance Variables and Methods are not shown in System Browser

Stan Shepherd
In case anyone else is looking for this as I was, the way to add the method in visibly is:

addAndClassifySelector: selector withMethod: compiledMethod inProtocol: category notifying: requestor

This is in the ClassDescription class.

...Stan