#2940 info globals doesn't recognize ::

obsolete: 8.4.6
closed-fixed
5
2004-10-31
2004-10-30
harm olthof
No

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.

Discussion

  • miguel sofer

    miguel sofer - 2004-10-30

    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 ':'

     
  • Donal K. Fellows

    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

     
  • Donal K. Fellows

    • status: open --> closed-fixed