Check out the new USENIX Web site. next up previous
Next: Lifetimes Up: Names, Lifetimes, Types and Previous: Names, Lifetimes, Types and

Names

Nickle supports first-class function values with full static scope. The visibility of a name is controlled by its scope, and by its relationship to its namespace. Nickle namespaces are similar to Java modules, except that they are purely syntactic rather than having anything to do (in principle or in current practice) with the filesystem. The closest notion is probably namespaces in C++. In brief, a namespace is opened by a namespace declaration. Each name declared in a namespace may have one of three possible visibilities:

public   The name should be visible outside the current namespace, and should be automatically imported.
protected   The name should be accessible from outside the namespace via an explicit path, but should not be made directly available by import declarations.
(no keyword)   The name should be completely inaccessible outside the namespace.

Names in a namespace may be referenced in one of two ways. First, public and protected names may be accessed via an explicit namespace qualifier ::. Thus, the name Foo::bar refers to the name bar in the namespace Foo. Second, the public names in a namespace may be brought into unqualified scope using an import declaration. For some example uses of namespaces see Figure 3 below and the Appendix.


next up previous
Next: Lifetimes Up: Names, Lifetimes, Types and Previous: Names, Lifetimes, Types and
Bart Massey 2001-04-19