Thanks for the help Jeff.  I was messing around with eval, but
without luck.  Changing to:

proc xyzzy1 {arg1 args} {
  return [eval [list xyzzy0 $arg1] $args]
}

proc xyzzy2 {arg1 args} {
  return [eval [list xyzzy1 $arg1] $args]
}

works like a charm.  Much appreciated.

Jim


>
> > TCL (we're on 7.6) has a special variable name "args" for variable
> > arguments.  It seems to work fine for 1 level, but I'm confused if/how
> > it can be used for multiple procedure levels since it "listifies" its
> > argument on every procedure call.
>
> You want to make use of "eval":
>
> proc foo {args} {
>         eval bar $args
> }
>
> proc bar {args} {
>         puts stdout [info level 0]
> }
>
> eval "breaks out" one level of list structure.  You have to watch
> out that you preserve args that need to remain such.  Like so:
>
> proc foo {cmd args} {
>         eval [list bar $cmd] $args
> }
>
> proc bar {cmd args} {
>         puts [info level 0]
> }
>
>   Jeff Hobbs                     The Tcl Guy
>   Senior Developer               http://www.ActiveState.com/
>       Tcl Support and Productivity Solutions
>  Join us in Sept. for Tcl'2002: http://www.tcl.tk/community/tcl2002/
>

Reply via email to