No registered users in community xowiki
in last 10 minutes
in last 10 minutes
Re: [Xotcl] Bug! 1.3.1 Nonpositional args and default arguments values
From: Uwe Zdun <uwe.zdun_at_wu-wien.ac.at>
Date: Wed, 15 Sep 2004 12:02:02 +0200
Hi Bryan,
thanks for reporting this bug. I have fixed it and updated the snapshot at:
http://wi.wu-wien.ac.at/~uzdun/resources/xotcl-1.3.2.tar.gz
could you please check whether this one works as expected?
Uwe
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.
>
>Regards.
>-- bryan
>
>_______________________________________________
>Xotcl mailing list - Xotcl_at_alice.wu-wien.ac.at
>http://alice.wu-wien.ac.at/mailman/listinfo/xotcl
>
>
Date: Wed, 15 Sep 2004 12:02:02 +0200
Hi Bryan,
thanks for reporting this bug. I have fixed it and updated the snapshot at:
http://wi.wu-wien.ac.at/~uzdun/resources/xotcl-1.3.2.tar.gz
could you please check whether this one works as expected?
Uwe
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.
>
>Regards.
>-- bryan
>
>_______________________________________________
>Xotcl mailing list - Xotcl_at_alice.wu-wien.ac.at
>http://alice.wu-wien.ac.at/mailman/listinfo/xotcl
>
>
-- 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