[Xotcl] Missing introspection methods for class methods
Arthur Schreiber
schreiber.arthur at googlemail.com
Fri May 25 11:28:57 CEST 2012
Hello Gustaf,
as far as I can see, nx is currently missing any methods to introspect
class level methods. (I know there is info lookup, but that's not exactly
what I want to do).
Also, as classes can be treated as objects, it's confusing that that
calling `MyClass info methods` returns the instance methods of the class,
whereas `$my_object info methods` returns the objects callable methods.
Thus, I propose the following changes to bring these two in line:
* `info methods` should return the callable methods of an object, no
matter whether it is a class or an object instance.
* `info methods -self` should return the callable methods defined in this
object, no matter whether it is a class or an object instance. This should
not include inherited methods. So for objects, this would only return
methods defined on that object directly, and for classes, this would only
return class methods directly defined on it.
* `info method $subcmd $method` should work as in the current
implementation for objects, but when called on a class, it should not
target its instance methods but only directly callable methods.
Only for classes (and mixins):
* `info instance_methods` should return all instance methods defined in
the class/mixin and it's ancestors.
* `info instance_methods -self` should return all instance methods defined
in the class/mixin.
* `info instance_method $subcmd $method` should work as `info method`, but
for instance methods of the class/mixin and it's ancestors.
What's your opinion on this?
Kind regards,
Arthur
More information about the Xotcl
mailing list