No registered users in community xowiki
in last 10 minutes
in last 10 minutes
Re: [Xotcl] Non-pos arguments with args
From: Gustaf Neumann <neumann_at_wu-wien.ac.at>
Date: Fri, 17 Feb 2006 18:53:07 +0100
Hi Kurt,
uff, this was mean: i did take me a while that the dashes from your
examples are not minus
signs, but different chars (hex e2 80 93; compare "-" with "-").
however, the bug occurs as well with the minus sign, so i expect these
dashes were
introduced by your mail client.
below is a patch for xotcl-1.3.9, that will be included in the
forthcoming xotcl 1.4.0
-gustaf
=========================================================
--- generic/xotcl.c-orig 2005-12-09 10:43:19.000000000 +0100
+++ generic/xotcl.c 2006-02-17 18:44:20.000000000 +0100
_at__at_ -10437,7 +10437,12 @@
ordinaryArgsCounter++;
}
}
- if (!argsDefined) {
+ if (argsDefined) {
+ if (ordinaryArgsCounter == 0) {
+ Tcl_SetVar2(in, "args", 0, "", 0);
+ }
+ } else {
+ /* !argsDefined */
if (ordinaryArgsCounter != ordinaryArgsDefc) {
/* we do not have enough arguments, maybe there are default arguments
for the missing args */
=========================================================
Kurt Stoll schrieb:
>
>
> I am having difficulty getting non-positional arguments to behave
> correctly with args. The simple example below shows what I have
> found. This does not appear to be appropriate behavior. Am I doing
> something wrong?
>
>
>
> Object obj
>
> obj proc pr1 { {-npos default} args } {
>
> puts "npos: $npos"
>
> puts "args: $args"
>
> }
>
>
>
>> ## This works:
>
>> obj pr1 a
>
> npos: default
>
> args: a
>
>>
>
>> ## As does this:
>
>> obj pr1 -npos 3 a
>
> npos: 3
>
> args: a
>
>>
>
>> ## But this does not:
>
>> obj pr1 -npos 3
>
> npos: 3
>
> args: -npos 3
>
>>
>
>> ## I expected args to be {}, but instead it contains the
> non-positional parameter
>
>
>
> Thanks for any insight you can provide.
>
>
>
> -Kurt Stoll
>
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Xotcl mailing list
>Xotcl_at_alice.wu-wien.ac.at
>http://alice.wu-wien.ac.at/mailman/listinfo/xotcl
>
>
Date: Fri, 17 Feb 2006 18:53:07 +0100
Hi Kurt,
uff, this was mean: i did take me a while that the dashes from your
examples are not minus
signs, but different chars (hex e2 80 93; compare "-" with "-").
however, the bug occurs as well with the minus sign, so i expect these
dashes were
introduced by your mail client.
below is a patch for xotcl-1.3.9, that will be included in the
forthcoming xotcl 1.4.0
-gustaf
=========================================================
--- generic/xotcl.c-orig 2005-12-09 10:43:19.000000000 +0100
+++ generic/xotcl.c 2006-02-17 18:44:20.000000000 +0100
_at__at_ -10437,7 +10437,12 @@
ordinaryArgsCounter++;
}
}
- if (!argsDefined) {
+ if (argsDefined) {
+ if (ordinaryArgsCounter == 0) {
+ Tcl_SetVar2(in, "args", 0, "", 0);
+ }
+ } else {
+ /* !argsDefined */
if (ordinaryArgsCounter != ordinaryArgsDefc) {
/* we do not have enough arguments, maybe there are default arguments
for the missing args */
=========================================================
Kurt Stoll schrieb:
>
>
> I am having difficulty getting non-positional arguments to behave
> correctly with args. The simple example below shows what I have
> found. This does not appear to be appropriate behavior. Am I doing
> something wrong?
>
>
>
> Object obj
>
> obj proc pr1 { {-npos default} args } {
>
> puts "npos: $npos"
>
> puts "args: $args"
>
> }
>
>
>
>> ## This works:
>
>> obj pr1 a
>
> npos: default
>
> args: a
>
>>
>
>> ## As does this:
>
>> obj pr1 -npos 3 a
>
> npos: 3
>
> args: a
>
>>
>
>> ## But this does not:
>
>> obj pr1 -npos 3
>
> npos: 3
>
> args: -npos 3
>
>>
>
>> ## I expected args to be {}, but instead it contains the
> non-positional parameter
>
>
>
> Thanks for any insight you can provide.
>
>
>
> -Kurt Stoll
>
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Xotcl mailing list
>Xotcl_at_alice.wu-wien.ac.at
>http://alice.wu-wien.ac.at/mailman/listinfo/xotcl
>
>