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 ""
|
The current package imports all functions from pkgName or aPackage.
package("foo")
function x() 100
y = 200
package("bar")
use("foo")
x ==> function x
y ==> error
package("")
x ==> error
y ==> error
|
- findPackage(String packageName)
|
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(String packageName)
|
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 ""
|
- aPackage .defined (String 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 (String 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
|
Persistence
This feature is supported only for the pure interpreter.
Save the symbol table of the the specified package into outputStream.
e.g.
package().save(open("/tmp/save.pkg", "w"))
|
This function saves only serializable objects from the symbol table of the
target package.
If "pnuts.debug" property is "true", name and value of
variables to be saved are displayed.
- package = readObject ( filename )
- package ( package )
|
e.g.
package(readObject("/tmp/save.pkg"))
|
If "pnuts.debug" property is "true", names and values to be
read are displayed.