Tcl Source Code

View Ticket
Login
Ticket UUID: 458548
Title: [proc] allows :: in arg names
Type: Bug Version: obsolete: 8.3.3
Submitter: kennykb Created on: 2001-09-04 22:11:08
Subsystem: 22. [proc] and [uplevel] Assigned To: msofer
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2001-09-05 05:47:27
Resolution: Fixed Closed By: msofer
    Closed on: 2001-09-04 22:47:26
Description:
The [proc] command allows namespace qualifiers in arg names:

proc x ::y { puts [info locals] } ; x z

The resulting variables cannot be accessed because any attempt to use
either [set] or $ substitution will search some namespace for them, rather
than looking for locals.

[proc] shouldn't allow namespace-qualified names.
User Comments: msofer added on 2001-09-05 05:47:27:

File Added - 10382: 458548.patch

msofer added on 2001-09-05 05:47:26:
Logged In: YES 
user_id=148712

The attached patch fixes the bug; committed to HEAD.

dgp added on 2001-09-05 05:15:39:
Logged In: YES 
user_id=80530


This can also lead to confusion when the
argument containing namespace separators
just happens to have the same name as
an actual namespace variable:

namespace eval one {
    proc foo two::x {
        set two::x
    }
}

puts "[catch {one::foo 1} msg] $msg"

namespace eval one::two {
    variable x 2
}

puts "[catch {one::foo 1} msg] $msg"

Attachments: