[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-users] Referring to class methods as functions



Hi there, is there a trick to refer to class methods as though they were regular functions?  For example I'm trying to take a class method (which takes a string argument and returns a string) and assign it to preProcess (the Interpreter preprocessor callback function).

It works fine if I wrap it in a function, but can I somehow directly set it?

Evaluating the following seems to mess things up:

this.preProcess = MyClass.class.findMethod('myMethod');

but this works fine:

this.preProcess = { |code| MyClass.myMethod(code) };

Thanks,
Glen.

P.S. MyClass.class.findMethod('myMethod') does correctly return my class method, not 'nil'.