Skip to content
Tcl Source Code History Of Ticket 1274918
Login

History Of Ticket 1274918

Artifacts Associated With Ticket 1274918

  1. Ticket change [724f6d3095] (rid 100835) by msofer on 2005-08-28 01:36:47:

    1. assignee initialized to: "msofer"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      This supersedes Bug #959831.
      
      There are two (related, important) issues that the
      [upvar] docs do not describe: what it does when called
      outside a proc body, and how it handles qualified
      variable names.
      
      The behaviour outside of proc bodies just needs
      documenting: 
         upvar ?level? otherVar myVar ?otherVar myVar ...?
      will create a variable named myVar in the current
      namespace (assuming for now that myVar is not
      qualified) linked to the variable otherVar as resolved
      in the corresponding stack frame. This is the same
      behaviour as documented in upvar.c, just replacing
      "current procedure" by "current context". The fact that
      this variable can never be unset until the namespace is
      deleted deserves mention - and maybe a fix too?
      
      The behaviour when otherVar is qualified is completely
      unspecified in the manual page. This may not be a
      problem, the behaviour is without surprises: the
      variable that is linked to is otherVar as resolved in
      the corresponding stack frame.
      
      The behaviour when myVar is qualified is also
      unspecified in the manual page, and is currently buggy
      (Bug #1274916).
      
    4. foundin initialized to: "None"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "msofer"
    9. subsystem initialized to: "07. Variables"
    10. title initialized to: "doc: upvar and qualified varNames"
    11. type initialized to: "Bug"
  2. Ticket change [4bd9a39c78] (rid 126774) by msofer on 2006-08-26 02:45:32:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      Note that the issue for qualified otherVar is not quite trivial:
      % namespace eval a {}; namespace eval a::b {}; namespace
      eval b {}
      % set b::x ::b
      ::b
      % namespace eval a {upvar 0 b::x w; set w}
      ::b
      % set a::b::x ::a::b
      ::a::b
      % namespace eval a {upvar 0 b::x w; set w}
      ::a::b
      
      In the example above
        namespace eval a {upvar 0 b::x w}
      the new variable should(?) be linked (in order) to:
      
        (1) ::a::b::x if the namespace ::a::b exists
        (2) ::b::x     if the namespace ::b     exists
      
      Note that this refers to the existence of namespaces; the
      usual resolution rules (and the actual upvar behaviour)
      refer to the existence of the variables themselves, the
      reference is to:
      
        (1) ::a::b::x if the variable ::a::b::x exists
        (2) ::b::x     if the variable ::b::x     exists
        (3) ::a::b::x otherwise (even if ::b exists but ::a::b
      does not)
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  3. Ticket change [25604fc518] (rid 88163) by msofer on 2006-08-26 09:26:37:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      There is madness in here:
      % namespace eval a {namespace eval b {}}
      % namespace eval b {}
      % set b::x 1
      1
      % namespace eval a {
         upvar 0 b::x s b::y t
         set s 2
         set t 3
      }
      3
      % set b::x
      2
      % info vars b::*
      ::b::x
      % info vars a::b::*
      ::a::b::y
      
      Ie: [upvar 0 b::x s b::y t] creates vars linked to different
      namespaces. This is definitely not the path of least surprise.
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  4. Ticket change [a1fb5c3cb4] (rid 109816) by msofer on 2006-09-30 08:09:52:

    1. priority changed to: "8"
  5. Ticket change [6ca5fcdc57] (rid 128552) by msofer on 2009-05-01 08:21:25:

    1. priority changed to: "7 High"