Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2005-08-28
08:38 • Ticket [959831ffff] doc: global and qualified varNames? status still Closed ... artifact: 06221cd3b7 user: msofer
08:38 • Closed ticket [959831ffff]. artifact: 588c610c45 user: msofer
2004-05-26
03:16 • Ticket [959831ffff]: 6 changes artifact: d5a37a9a38 user: msofer
01:29 • Ticket [959831ffff]: 4 changes artifact: c3af9d205c user: jenglish
2004-05-25
23:58 • Ticket [959831ffff]: 4 changes artifact: 62a8ffc7f2 user: msofer
23:58 • Add attachment global.n to ticket [959831ffff] artifact: 022a1e6a78 user: msofer
23:58 • Ticket [959831ffff] global.n, upvar.n: qualified varNames? status still Open... artifact: 9b6dc5a22e user: msofer
21:28 • Open ticket [959831ffff]. artifact: 5b6bc1b389 user: msofer
21:11 • Closed ticket [959831ffff]. artifact: b1735a3072 user: msofer
01:44 • New ticket [959831ffff]. artifact: c9cda2537e user: msofer

doc: global and qualified varNames?

Closed / Fixed959831ffffffffffffffffffffffffffffffffffCreated 23 years agoUpdated 21 years ago
Descriptionplain2004-05-25 01:44:07
The manual pages for global and upvar commands do not
explain the behaviour when the variable names contain
namespace qualifiers.

This is not so bad for upvar, as the behaviour is quite
intuitive. Not the same for global ...

One possibility is to explain global's behaviour, and
show that it could be defined as
  
   proc global args {
       if {[info level] < 2} {
           return
       }
       set cmdName [namespace tail [lindex [info level
-1] 0]]
       if {[info procs $cmdName] eq {}} {
           return 
       }
       set cmd [list upvar 0]
       foreach var $args {
           lappend cmd ::$var [namespace tail $var]
       }
       uplevel 1 $cmd
       return
    }
msofer Closed ticket [959831ffff]. [History diff]2004-05-25 21:11:58
msofer Open ticket [959831ffff]. [History diff]2004-05-25 21:28:47
msoferplain2004-05-25 23:58:43
Logged In: YES 
user_id=148712

Attached proposal for global.n; request comments
msoferplain2004-05-25 23:58:44
File Added - 88378: global.n
jenglishplain2004-05-26 01:29:41
Logged In: YES 
user_id=68433

New text looks good, though I'd suggest leaving out the part
about "global can be defined in terms of other builtin
commands as: [...]".  The Tcl equivalent doesn't make things
any clearer, since to understand it you first have to
understand all the details of [info level], [namespace
tail], [upvar], and [uplevel].  (Plus, I'm not sure it's
even correct).
msoferplain2004-05-26 03:16:37
Logged In: YES 
user_id=148712

global.n fixed; upvar.n not yet ...
msoferplain2005-08-28 08:38:57
Logged In: YES 
user_id=148712

Moved the [upvar] issue to Bug #1274918, closed the ticket
and changed the summary accordingly
msofer Ticket [959831ffff]: 2 changes [History diff]2005-08-28 08:38:58
Log in (anonymous is fine) to add a comment.

Attachments: