Tcl Source Code

View Ticket
Login
Ticket UUID: 0e4b7fce57ddc428e5fab63a237e43c039be428b
Title: Running [info vars] in a namespace returns global variables
Type: Bug Version: 9.0b2
Submitter: sbron Created on: 2024-07-14 13:20:29
Subsystem: 07. Variables Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2024-07-14 19:34:54
Resolution: Fixed Closed By: sebres
    Closed on: 2024-07-14 19:34:54
Description:

Running info vars in a fresh namespace in Tcl 9 reports the same list of variables that Tcl 8.6 does; the existing global variables.

However, since TIP #278 was implemented, global variables are no longer directly visible from within a namespace. They can only be accessed using their fully qualified names. It is therefor unexpected that info vars still reports them, especially by their simple name.

I also don't think the globals should be reported by info vars using their fully qualified name, because all variables can be accessed using their fully qualified names. Then, if globals are included that way, then all variables in all namespaces should be included. That would quickly become a mess.

User Comments: sebres added on 2024-07-14 19:34:54:

Fixed in [5d2e5c3e82] (with small amend and better test coverage), thus closing the ticket now as fixed.


sbron added on 2024-07-14 14:00:37:

First attempt at a fix in the bug-0e4b7fce57 branch.

This change caused no test failures, so it seems that this functionality could also use better testing.