View · Search · Index
No registered users in community xowiki
in last 10 minutes

[Xotcl] Re: [Xotcl] Problem with info args

From: Uwe Zdun <bm0005_at_sp2.power.uni-essen.de>
Date: Sat, 17 Feb 2001 09:10:02 +0100 (MEZ)

On Sat, 17 Feb 2001, Kristoffer Lawson wrote:

>
>
> Code:
>
> Class Foo
>
> Foo instproc init {} {
> puts [[self] info args myMethod]
> }
>
> Foo instproc myMethod {anArgument} {}
> Foo ob
> ==> expected a tcl method name but got myMethod
>
>
> This works as expected if I simply create an Object as follows:
>
> Object foo
> foo proc myMethod {anArgument} {}
> foo info args myMethod
> ==> anArgument
>
> Is this behaviour to be expected, and if so, why?
>

it is intented, because args only introspects the arguments for
procs. For instprocs there is a method "instargs" for the class
object. You will get the expected behavior with:

Foo instproc init {} {
  puts [[self class] info instargs myMethod]
}
Foo ob
--> anArgument

with "[self class] info args" you'll get the args of class-specific
procs

--Uwe