Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 352
user3452568 Avatar asked Oct 22 '14 13:10

user3452568


1 Answers

Try this:

methodExample
    ^(Processor activeProcess stackAtFrame: 0 offset: -9) selector
like image 179
David Buck Avatar answered Nov 06 '22 01:11

David Buck