use*_*568 5 oop reflection smalltalk visual-age
假设我有一个类和一个实例方法:
ClassExample#methodExample
^"???"
Run Code Online (Sandbox Code Playgroud)
有没有办法在Smalltalk中获取方法的名称:
var := ClassExample new.
nameOfMyMethod := var methodExample.
"nameOfMyMethod should be 'methodExample' (a string or symbol)"
Run Code Online (Sandbox Code Playgroud)
?
我正在开发VisualAge.感谢帮助!
试试这个:
methodExample
^(Processor activeProcess stackAtFrame: 0 offset: -9) selector
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
208 次 |
| 最近记录: |