Skip to content
Tcl Source Code History Of Ticket 1251123fffffffffffffffffffffffffffffffff
Login

History Of Ticket 1251123fffffffffffffffffffffffffffffffff

Artifacts Associated With Ticket 1251123fffffffffffffffffffffffffffffffff

  1. Ticket change [6469b56e58] (rid 92765) by oox on 2005-08-03 15:51:49:

    1. assignee initialized to: "msofer"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      Consider the following: 
      
      (bin) 1 % namespace eval ::N {set bar 2} 
      2 
      (bin) 2 % puts $bar 
      can't read "bar": no such variable 
      (bin) 3 % puts $::N::bar 
      2 
      (bin) 4 % set foo 1 
      1 
      (bin) 5 % puts $foo 
      1 
      (bin) 6 % namespace eval ::N {set foo 2} 
      2 
      (bin) 7 % puts $foo 
      2 
      (bin) 8 % puts $::N::foo 
      can't read "::N::foo": no such variable 
      
      I would expect line 6 to create ::N::foo, in the same way 
      that line 1 created ::N::bar, but Tcl notices that ::foo 
      exists, and somehow resolves to it. The NAME 
      RESOLUTION section of the [namespace] manual page 
      says that for unqualified names the following 
      applies: "Command and variable names are always 
      resolved by looking first in the current namespace, and 
      then in the global namespace". This applies 'correctly' 
      to variable *access*, but in a funny way to variable 
      *creation*. 
      
      What is worse, command creation behaves differently: 
      invoking [proc] with an unqualified procedure name 
      within a namespace creates the procedure in that 
      namespace irrespectively on whether or not an equally 
      named procedure already exists in the global 
      namespace. 
      
      I understand that modyifing variable resolution rules is 
      something to be avoided. What I propose is adding a 
      sentence to the NAME RESOLUTION section of the 
      [namespace] manual page above describing this 
      observed behaviour.
      
    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: "oox"
    9. subsystem initialized to: "21. [namespace]"
    10. title initialized to: "Variable resolution behaviour and documentation"
    11. type initialized to: "Bug"
  2. Ticket change [f0863e7616] (rid 109209) by msofer on 2005-08-03 23:20:06:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      I agree that this behaviour is nasty. It probably will have
      to remain as it is in the Tcl8 line, and be fixed in Tcl9.
      
      The problem is compounded with a surprising definition of
      "existence" for variables (see bug 959052).
      
      The fix is of course to avoid accessing ns variables without
      "declaring" them first using the [variable] command. This is
      very frustrating.
      
      Do you have a concrete proposal for that explanatory sentence? 
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  3. Ticket change [f5c7adc82b] (rid 130171) by oox on 2005-08-03 23:59:26:

    1. icomment:
      Logged In: YES 
      user_id=662619
      
      I've seen bug 959052: whow!
      
      >
      > Do you have a concrete proposal for 
      > that explanatory sentence? 
      >
      I knew you were going to ask that one!  :-)
      
      Given the fact that [variable] "behaves properly", I concede 
      that writing such a sentence is difficult.
      
      In fact the current behaviour for variables is consistent with 
      the documentation: if the variable does not exist in the 
      current namespace, Tcl scans the global namespace: if it 
      does exist there, then Tcl resolves to that. The problem, as I 
      see it, is that [proc] behaves differently:
      
      % proc x {} {puts "Proc in [namespace current]"}
      % namespace eval ::N { proc x {} {puts "Proc in [namespace 
      current]"} }
      
      That creates both ::x and ::N::x !
      
      May we add something like "(except that [proc] will create a 
      new procedure in a namespace instead of overwiting an 
      equally named procedure in the global namespace)"  ?
      
      Juan Carlos---
      
      
    2. login: "oox"
    3. mimetype: "text/plain"
    4. username: "oox"
  4. Ticket change [a9b2c88ff7] (rid 99190) by dkf on 2005-08-04 00:15:25:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      Don't mix command and variable resolution.  Command
      resolution is right.
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  5. Ticket change [ca234cee9d] (rid 122410) by msofer on 2006-09-30 08:11:24:

    1. closedate changed to: "2006-09-30T01:11:24"
    2. closer changed to: "msofer"
    3. resolution changed to: "Invalid"
    4. status changed to: "Closed"