【发布时间】:2012-03-12 12:55:23
【问题描述】:
我在TCL中看到了一些这样的代码:
namespace eval ::info {
set count 0;
set id 1;
set role admin;
namespace export *
}
proc ::info::setcount {
set ::info::count 0;
}
proc ::info::setId {
set ::info::id 1;
}
proc ::info::setRole {
set ::info::role user;
}
命名空间::info中定义了三个变量,但是命名空间中没有声明三个procs(setcount setId setRole),好像是在::info之外定义的,这样可以吗?这是如何工作的?
【问题讨论】:
标签: namespaces tcl proc