Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 5c959e450c8c30dfc7b4ab718efe5e8e68884362
Ticket: 604226ffffffffffffffffffffffffffffffffff
[variable] should always create a link
User & Date: msofer on 2006-10-31 02:36:43
Changes

  1. closedate changed to: "2006-10-30T19:36:43"
  2. closer changed to: "msofer"
  3. icomment:
    Logged In: YES 
    user_id=148712
    
    We isunderstood the purpose and/or docs of [variable].
    Looking at namespace-old.test, I see that the usage there
    (and, from the comments, possibly an idiom in itcl) really
    requires the current behaviour outside of proc bodies.
    
    Consider test namespace-old.6.16 - to reduce headaches,
    notice that
      - there are no linked variables there
      - $trigger has been last defined in test 6.12, and is
           {set test_ns_cache_var}
      - $trigger2 has been last defined in test 6.15 and is
           {set test_ns_cache2::test_ns_cache_var}
    
    The test body is
    
     variable test_ns_cache1::test_ns_cache2::test_ns_cache_var
    "blah"
     list [namespace eval test_ns_cache1 $trigger2] \
          [namespace eval test_ns_cache1::test_ns_cache2 $trigger]
    
    Here [variable] is being used to set the value of the variable
    
       ::test_ns_cache1::test_ns_cache2::test_ns_cache_var
    
    from the global space, but without a fully qualified name
    (why?). If a variable ::test_ns_cache_var were created to
    point to it, all manner of nastyness could ensue: a new
    GLOBAL variable that may break whatever code relies on the
    second lookup path, and wasted resources as the programmer
    never expected that new variable to be created.
    
    In order to link variables, use [upvar] or [namespace upvar].
    
    
    
  4. login: "msofer"
  5. mimetype: "text/plain"
  6. resolution changed to: "Rejected"
  7. status changed to: "Pending"
  8. username: "msofer"