Question: interrogating a method's arguments

Bob Arning arning at charm.net
Mon May 19 11:35:14 UTC 2003


On Mon, 19 May 2003 08:00:30 +0200 "Brent Pinkney" <pinkney_b at aircom.co.za> wrote:
>What is the preferred way to access the arguments passed to a method ?
>
>Specifically I would like to get an Array of the arguments.
>
>e.g
>
>Foo>>#bar: aBar baz: aBaz baq: aBaq
>	"Negate all my arguments before continuing..."
>	thisContext arguments do: [ :arg | arg := arg negated ].
>
>
>
>There is (suprisingly) no #arguments method for thisContext.

Well, you could try this...

'From Squeak3.2gamma of 15 January 2002 [latest update: #4743] on 19 May 2003 at 7:33:21 am'!

!MethodContext methodsFor: 'accessing' stamp: 'RAA 5/19/2003 07:32'!
arguments

	^(1 to: method numArgs) collect: [ :each | self tempAt: each]! !

Cheers,
Bob



More information about the Squeak-dev mailing list