Package is a separate name space in which variables and functions are defined.
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 ""
This builtin function imports all functions from a module, pkgName. Imported functions can be called without specifying the package name.
package("foo")
function x() 100
y = 200
package("bar")
use("foo")
x ==> function x
y ==> error
package("")
x ==> error
y ==> error
foo = 100 package().foo ==> 100 package().foo = 200 foo ==> 200 package().bar ==> null
Package.defined method checks if the specified symbol name is defined in the target package.
getPackage("foo")
context = getContext()
findPackage("foo").defined("bar", context) ==> false
foo::bar = 100
findPackage("foo").defined("bar", context) ==> true
Package.clear method removes the specified symbol in the target package.
context = getContext()
findPackage("foo").defined("bar", context) ==> true
findPackage("foo").clear("bar", context)
findPackage("foo").defined("bar", context) ==> false