Question: interrogating a method's arguments
Jon Hylands
jon at huv.com
Tue May 20 13:19:58 UTC 2003
On Tue, 20 May 2003 10:27:10 +0100 , goran.krampe at bluefish.se wrote:
> 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
How about:
Test2 class>>a: a b: b c: c
"Test2 a: 1 b: 2 c: 3"
^(1 to: thisContext method numArgs) collect: [:each |
thisContext at: each]
Later,
Jon
--------------------------------------------------------------
Jon Hylands Jon at huv.com http://www.huv.com/jon
Project: Micro Seeker (Micro Autonomous Underwater Vehicle)
http://www.huv.com
More information about the Squeak-dev
mailing list
|