Package
This section describes the basic usage of Package in Pnuts.
package()
- package(packageName or aPackage)
- package( )
|
package() with one argument changes the current package to the
specified package. package() with no argument returns the Package object of the
current package.
package("foo") ==> package "foo"
package() ==> package "foo"
package("") ==> package ""
package() ==> package ""
|
findPackage()
findPackage() returns the Package object of the specified name. If the package
does not exist it returns null.
findPackage("foo") ==> null
package("foo") ==> package "foo"
package("")
findPackage("foo") ==> package "foo"
package() ==> package ""
|
getPackage()
getPackage() returns Package object of the specified name. If it
does not exist it creates one and return it.
package() ==> package ""
findPackage("bar") ==> null
getPackage("bar") ==> package "bar"
package() ==> package ""
|
Symbol definition in a package
- aPackage .defined ( symbolName )
|
Package.defined method checks if the specified symbol name is defined
in the target package.
getPackage("foo")
findPackage("foo").defined("bar") ==> false
foo::bar = 100
findPackage("foo").defined("bar") ==> true
|
- aPackage .clear ( symbolName )
|
Package.clear method removes the specified symbol
in the target package.
findPackage("foo").defined("bar") ==> true
findPackage("foo").clear("bar")
findPackage("foo").defined("bar") ==> false
|