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
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).
one can use "/cls/ class info methods" to introspect class level methods. See e.g.
http://next-scripting.org/docs/2.0b3/doc/nx/nx-migration/index1#_introspecti...
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.
keep in mind, that "method" is used to create either class level methods (available for instances of the class) and object level methods (available for objects). Object level methods are defined by
/obj/ method foo args {....} /cls/ class method bar args {....}
The latter one defines "bar" as a method of the class object.
"/obj/ info methods" returns always the methods defined by the entity, where as "/obj/ info lookup methods ..." returns the methods callable by the obj (consumer side).
all the best -gustaf neumann