Leopold Toetsch wrote:
Sam Ruby wrote:
My need is to be able to call add_method for methods defined as @ANON.
This doesn't make sense to me. The @ANON pragma avoids the add_method (or store_global) call in the first place.
I don't want the method added to a namespace, or stored as a global. I want it stored as a property of a class object.
From the perspective of Parrot, namespaces should be viewed a perfectly reasonable mechanism for implementing classes, and there perhaps should even be special support for enabling classes to be defined that way... but: there should be no built in assumptions that all classes are defined in this way.
Yes. But OTOH a different scheme should only be used if it's unavoidable.
Python classes are not namespaces. Nor are they global. They are dictionaries.
Take a look at the last test in parrot/languages/python/t/basic/oo_class.t to get an idea of what I am talking about.
- Sam Ruby