[Xotcl] Bug! 1.3.1 Nonpositional args and default arguments values

Uwe Zdun uwe.zdun at wu-wien.ac.at
Wed Sep 15 12:02:02 CEST 2004

Hi Bryan,

thanks for reporting this bug. I have fixed it and updated the snapshot at:


could you please check whether this one works as expected?


Schofield, Bryan (GE Transportation) wrote:

>Hullo -
>I found a little bug with non-positional arguments & regular default arguments in version 1.3.1. Consider the following example:
>  Object o
>  o proc foo {{-a apple}} {{b banana}} {
>     puts "FOO: [info locals]"
>     puts "a: $a   b: $b"
>  }
>We have a method "foo" that has one optional argument, "b", and one option non-positional argument, "a". Now consider the possible ways to call this method:
>  o foo
>  o foo -a ack
>  o foo bar
>  o foo -a ack bar
>In the cases where we let "b" use it's default value of "banana", we will get the error:
>  wrong # args: should be {{b banana}}
>In the cases where we specify "b", we will find that "b" is not valid variable in method scope. In fact, what is happening is that the variable "{b banana}" is being set. Should we try to use "$b", we will get the error:
>  can't read "b": no such variable
>It would seem that ::xotcl::interpretNonPositionalArgs does not take in to account for default values on regular type arguments.
>-- bryan
>Xotcl mailing list  -  Xotcl at alice.wu-wien.ac.at

Uwe Zdun
Department of Information Systems, Vienna University of Economics
Phone: +43 1 313 36 4796, Fax: +43 1 313 36 746
zdun at acm.org, uwe.zdun at wu-wien.ac.at

More information about the Xotcl mailing list