简体   繁体   中英

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!

Try this:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM