Skip to content
Tcl Source Code View Ticket
Login

View Ticket

info globals doesn't recognize ::

Closed / Fixed1057461fffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 22 years ago
Descriptionplain2004-10-30 20:57:22
according to help namespace:

"topmost or global namespace has the name ``'' (i.e., 
an empty string), although :: is a synonym"

so you expect:

[info globals ::tcl_platform], to give the 
same result as:
[info globals tcl_platform]

However, (win XP, Activestate 8.4.6):

info globals tcl_platform
tcl_platform

info globals ::tcl_platform
     
(i.e. empty string)


whereas:
(bin) 62 % puts $tcl_version
8.4
(bin) 63 % puts $::tcl_version
8.4

I think the [info globals] command is at least not 
consistent with respect to the naming convention and I 
would like to file it as a bug.
msoferplain2004-10-31 06:02:36
Logged In: YES 
user_id=148712

I agree that this is a bug; I tend to use [info vars], which
is saner in this respect.

Note to maintainer: [info globals] looks directly into the
global hashtable, without stripping leading '::' first - so,
no wonder that var is not found. 

One possible fix is to remove leading ':' (if two or more),
do the search, and then report the result with prepended
leading ':'
dkfplain2004-10-31 23:43:45
Logged In: YES 
user_id=79902

Hmm, correct thing to do is indeed to check if the pattern
starts with '::', and if so strip off the leading colons.
Any other chars can be left alone.

Fixed in HEAD and 8.4 branch
Log in (anonymous is fine) to add a comment.