smalltalk如何获取方法名称



假设我有一个类和一个实例方法:

 ClassExample#methodExample
      ^"???"

在Smalltalk中有没有任何方法可以获得方法的名称:

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

我在VisualAge中进行开发。谢谢你的帮助!

试试这个:

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

最新更新