NAME
protected - create commands/variables with "protected" access
SYNOPSIS
protected command ?arg arg ...?
DESCRIPTION
Sets the protection level for new commands/variables to "protected" and then evaluates the remaining arguments. Note that the default protection level for commands/variables is "public". Commands and variables can also be "private".
The command argument may be a command name like proc or variable, or a script full of command/variable declarations. Any command that creates another command or variable can be used in conjunction with the protected command. For example, if widget commands are executed via "protected", the widget access commands will be protected.
Protected commands/variables are accessible in the namespace where they are defined, and in any other namespace that imports the defining namespace in a "protected" mode. See the import command for details concerning the import list.
EXAMPLE
namespace foo {
protected {
variable x 0
variable y 1
}
protected proc check {} {
global x y
return "$x $y"
}
}
import add {foo protected}
foo::check
KEYWORDS
import, namespace, private, protected, public, variable, proc