Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 3d567df5fe0e983c94a463852c88001ec670d2ce
Ticket: 631741ffffffffffffffffffffffffffffffffff
[variable] should not call var resolvers
User & Date: msofer on 2003-02-25 09:13:31
Changes

  1. icomment:
    Logged In: YES 
    user_id=148712
    
    That is my understanding: if an extension defines a resolver
    for namespace ns, the script
    
      namespace eval ns { 
          set a 0
          proc test {} {set a 5}
          set a
      }
    
    *could well* return 5, not 0. Ie, if I understand correctly
    the way the resolvers work (see TclLookupSimpleVar,
    tclVar.c:640), the resolver has priority over the tcl rule
    that would make this a local var. 
    
    This seems to be what is tripping itcl here: in the example
    above (I'm more or less guessing what itcl's resolvers do)
       common foo
    causes that, in any proc in the test_globals class, the name
    "foo" refers to the namespace var and not to a local var.
    Thus, the new ObjMakeUpvar code finds the namespace variable
    "foo" when trying to create a local var "foo", and errors
    out with "can't upvar from variable to itself". 
    
    The previous MakeUpvar would sidestep calling the resolvers
    - it implemented a special case of variable lookup. 
    
    Chris: is my understanding correct so far?
    
    
  2. login: "msofer"
  3. mimetype: "text/plain"
  4. title changed to: ""variable" can't not call var resolvers"
  5. username: "msofer"