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

Re: [Xotcl] XOTcl1.5.6 and Tcl8.5b1

From: Gustaf Neumann <neumann_at_wu-wien.ac.at>
Date: Mon, 29 Oct 2007 22:32:50 +0100

Just a small followup: Since xotcl has about 30 tests for nonposargs,
which are
all passing for tcl 8.5, i was trying to extend the xotcl regression
test, and
found some more insight:

Your original script

  Class X
  X instproc ListOfStringsOption {{-default ""} {-cb ""} name} {
    if {$cb eq {}} { set cb "::set ::$name " } ;# global variable
    eval $cb \$default
  }

could be as well be repaired in 8.5 by avoiding eval with the new-style
expand operator

X instproc ListOfStringsOption {{-default {}} {-cb ""} name} {
    if {$cb eq {}} { set cb "::set ::$name " } ;# global variable
    {*}$cb $default
}

or strangely, by mentioning the variable "default" explicitely
in the procbody

  X instproc ListOfStringsOption {{-default ""} {-cb ""} name} {
    if {$cb eq {}} { set cb "::set ::$name " } ;# global variable
    set _ $default
    eval $cb \$default
  }

I have still no clear understanding why in the original version the
variable "default" is unknown within eval. Maybe there is a
bad interaction with the byte-code compiler in Tcl 8.5...

Anyhow, altering Tcl_ObjSetVar2() to Tcl_SetVar2Ex() on the C level
works fine in all cases.

best regards
-gustaf neumann