user3452568
user3452568

Reputation: 283

smalltalk reflection - how to get method name?

Assume I have a class and an instance method:

 ClassExample#methodExample
      ^"???"

Is there any way in Smalltalk to get the name of the method:

 var := ClassExample new.
 nameOfMyMethod := var methodExample.
 "nameOfMyMethod should be 'methodExample' (a string or symbol)"

?

I'm developing in VisualAge. Thanks for help!

Upvotes: 5

Views: 409

Answers (1)

David Buck
David Buck

Reputation: 2847

Try this:

methodExample
    ^(Processor activeProcess stackAtFrame: 0 offset: -9) selector

Upvotes: 5

Related Questions