Menu

#230 Namespace variable resolver woes

3.4
closed-fixed
5
2015-01-14
2012-09-06
Don Porter
No

package require Itcl
itcl::class Dog {
method bark {}
}
itcl::body Dog::bark {} {
variable bite
}
Dog fido
fido bark

can't upvar from variable to itself
while executing
"variable bite"
(object "::fido" method "::Dog::bark" body line 2)
invoked from within
"fido bark"

Itcl's custom namespace var resolver intervention on "bite"
is producing something the Tcl core cannot deal with
as intended, I think.

Discussion

  • Don Porter

    Don Porter - 2012-09-06

    I think the essence of the problem is that the Tcl
    core calls TclObjLookupVarEx() with the flag
    TCL_NAMESPACE_ONLY but the Itcl namespace
    var resolver steps in and sends back a reference
    to a proc-local variable.

     
  • Arnulf Wiedemann

    I tried the example with tcl 8.6 trunk and itcl 4.0b7 trunk and I do not get the error show above. What is different in my environment?

     
  • Don Porter

    Don Porter - 2012-09-09
    • milestone: 897187 --> 3.4
     
  • Don Porter

    Don Porter - 2012-09-09

    You do not have an Itcl 3.4 getting brought in
    by mistake. :)

    This is a bug in only Itcl 3.4. Itcl 4 doesn't
    suffer the problem.

     
  • Don Porter

    Don Porter - 2015-01-07

    Replacing the body with

    set variable variable
    $variable bite

    makes things work.

    This is a bug in the [variable] compiler.

     
  • Don Porter

    Don Porter - 2015-01-07

    Um "makes things work" may be an exaggeration.

    Avoids the same error message.

     
  • Don Porter

    Don Porter - 2015-01-07

    Arranging for AVOID_RESOLVERS to get added
    to the flags in the INST_VARIABLE implementation
    makes the error go away. No confidence at all
    that this is an actual solution.

     
  • Don Porter

    Don Porter - 2015-01-14

    Fixed for Itcl 3.4.2 release.

     
  • Don Porter

    Don Porter - 2015-01-14
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,4 +1,3 @@
    -
     package require Itcl
     itcl::class Dog \{
     method bark \{\}
    
    • status: open --> closed-fixed
    • assigned_to: Arnulf Wiedemann --> Don Porter
     

Log in to post a comment.

MongoDB Logo MongoDB