Question: interrogating a method's arguments
goran.krampe at bluefish.se
goran.krampe at bluefish.se
Tue May 20 09:27:10 UTC 2003
Hi Brent!
I haven't read the thread in detail but this seems to work (beware, I
usually don't muck around with thisContext etc so there may be Dragons
here):
Test2 class>>a: a b: b c: c
"Test2 a: 1 b: 2 c: 3"
| arr n |
n _ thisContext method numArgs.
arr _ Array new: n.
1 to: n do: [:i | arr at: i put: (thisContext at: i) ].
^arr
...if you create a class and add this class side method and test it by
alt-i on the comment above you should get an Array. Doing this 1000
times took 5ms on my Athlon laptop.
regards, Göran
More information about the Squeak-dev
mailing list
|