is there a way to introspectly print all methods inside module ? without being encapsulated in a class?
No, Introspection only works on classes.
But instead of a module, you could create a class with a private constructor and only Shared Methods.
i noticed that this has been implemented in other languages, it would be interesting to implement it in xojo as well
I agree that would be handy. Please file Feedback.
Requested 2004 - see “callbyname” as part of request. Still yet to be implemented.
What ticket number was that Matthew, I can’t see it and nothing is returned if I search for callbyname
The only ticket I can find is <https://xojo.com/issue/10999> from 2010, but Norman closed it as already exists, mentioning “With the Runtime module and introspection you can do this”, but I can’t figure it out.
Introspection will actually be useful if it allowed to pass a string to getType()
I use this extension quite often:
Public Function getMethod(extends o as introspection.typeInfo, name as string) As introspection.methodInfo
for each fn as Introspection.MethodInfo in o.GetMethods()
if fn.Name = name then return fn
next
return nil
End Function
Public Function hasMethod(extends o as introspection.typeInfo, name as string) As Boolean
for each fn as Introspection.MethodInfo in o.GetMethods()
if fn.Name = name then return true
next
return false
End Function
If interested in this topic you should vote on this feedback case: