From: Gustaf N. (sslmail) <ne...@wu...> - 2024-07-29 13:25:39
|
Dear all, I was recently caught by a mistake which is not easy to spot. In the following script, - the namespace resolution of the unqualified name “NAME1” when creating a proc leads to "[namespace current]::NAME1", while - the namespace resolution of the unqualified name “NAME2” when creating an alias leads to “::NAME2”. The following snippet creates via interp alias the cmd ::log namespace eval ::ns1 { proc log args {puts stderr "LOG called"} } namespace eval ::ns1::sub { proc foo {} { log foo } interp alias {} log {} ::ns1::log } while the following leads to the result i was expecting. Same results on Tcl8 and Tcl9 All the best -g namespace eval ::ns1 { proc log args {puts stderr "LOG called"} } namespace eval ::ns1::sub { proc foo {} { log foo } interp alias {} [namespace current]::log {} ::ns1::log } |