Tcl7.6 User Commands Man Page -- public (n)
Table of Contents


NAME

public - create commands/variables with "public" access

SYNOPSIS

public command ?arg arg ...?

DESCRIPTION

Sets the protection level for new commands/variables to "public" and then evaluates the remaining arguments. Note that the default protection level for commands/variables is "public". Other protection levels are "protected" and "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 public command. For example, if widget commands are executed via "public", the widget access commands will be public.

Public commands/variables are accessible from any namespace.

EXAMPLE

namespace foo {
public {
variable x 0
variable y 1
}
public proc check {} {
global x y
return "$x $y"
}
}
foo::check

KEYWORDS

namespace, private, protected, public, variable, proc


Table of Contents