Skip to content
Tcl Source Code View Ticket
Login

View Ticket

[proc] allows :: in arg names

Closed / Fixed458548ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 25 years ago
Descriptionplain2001-09-04 22:11:08
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.
dgpplain2001-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"
msoferplain2001-09-05 05:47:26
Logged In: YES 
user_id=148712

The attached patch fixes the bug; committed to HEAD.
msoferplain2001-09-05 05:47:27
File Added - 10382: 458548.patch
Log in (anonymous is fine) to add a comment.

Attachments: