> I'd also like them to worj with static functions, with functions in modules, etc.
I think you can create a Method for static functions, using new Method. According to the doc, the class passed in can be either a class definition or an instance.
I have tried this, and it seems to work:
new Method( WatchUi, :requestUpdate ).invoke();
Just for my use case it does not, because I cannot pass it as the interface.
I'd also like them to worj with static functions, with functions in modules, etc.
Maybe it would be good to clarify what "work" means.
Object.method() is designed to be called on a class instance (it's literally an instance method of Object, which all classes in the CIQ API are derived from). So it shouldn't be surprising that it does not work at all with a function in a module or a global function.
Furthermore, Object.method() provides full type information about the created method, so it would say it fully works. (Both from a functionality pov and a type safety pov.)
Speaking of static functions, if you mean a static class function, Object.method() seems to work fine with those as well.
--
Speaking of global functions and functions in modules, that is precisely what Lang.Method.initialize() / new Lang.Method() is for. new Lang.Method() certainly returns a callback method that can be used at runtime in the same way a callback created by Object.method(). As noted in this exact bug report, new Lang.Method() does not provide full type information about the created callback (it's just typed as a generic Method, with unknown args and return value).
So we can say that new Lang.Method() works as far as functionality goes, but it doesn't provide type safety.
--
If the complaint is that there should be a single function that somehow combines Object.method() and new Lang.Method(), that would be a criticism of the design / implementation, and not necessarily a point about things not "working".
As a matter of fact, as far as I can tell, Object.method(:someSymbol) is the same as new Lang.Method(self, :someSymbol), functionally speaking (disregarding the incomplete type information associated with the latter).
So it seems that CIQ could have had only one way to create a callback method (new Lang.Method()), but it would've actually made things more inconvenient for devs.
> In my case, Method actually does not fulfill the interface with invoke() I am using. And if I use Lang.Method() it (correctly) does trigger an error in the type-checker, and (incorrectly, but good for me) does not for Object.method().
Well it depends on the type of function that was used to create the Method.
In your case, new Lang.Method() can never fulfill the EvccTask interface because the compiler can't guarantee that the returned method has 0 args and returns nothing.
But Object.method() can fulfill the interface, provided the symbol you pass in refers to a function that has 0 args and returns nothing