(class)
A container for Curl language code.
Description
Package objects serve as the containers for all code objects. Every code object, such as class and function definitions, exist within at least one
Package object.
Although
Package is a concrete class, objects of the exact type
Package only result from importing a Curl package using
import or
import-package; such packages are already
frozen and may not be modified. The only useful operation that may be performed on such objects is to examine their
meta-data or
lookup symbols.
The subclass
OpenPackage is available for developers who wish to create modifiable package objects. All top-level applet code is evaluated in the context of an
OpenPackage.
The
Package object in which code is being currently compiled may be obtained using
this-package. The
Package object for the currently executing applet or script, may be obtained using
get-current-package.
accessor public final Package.imported-packages:{
FastArray-of Package}
| add: | Adds a binding for a name in the package. |
| get-members: | Returns all public members accessible through this package. |
|
public
| {Package.get-members check-imports?:bool = true }:{FastArray-of PackageMember} |
|
public
| {Package.get-nonlocal-option name:String, check-imports?:bool = true }:#Option |
|
public
| {Package.get-nonlocal-options check-imports?:bool = true }:{FastArray-of Option} |
| lookup: | Looks up a name in the package. |
(accessor)
accessor public final Package.imported-packages:{
FastArray-of Package}
Return packages directly imported by this package.
(method)
Adds a binding for a name in the package.
name: The name to be bound.
value: The value to be bound to name.
type: The compile-time type to be associated with the binding. This defaults to the type of the value. This type must be a supertype of the value's type.
access: The access level of the binding, which defaults to
BindingAccess.public. Values that do not make sense for package bindings, such as
BindingAccess.private and
BindingAccess.protected, will result in an error.
(method)
Lookup package member by name.
name: The name to be looked up.
check-imports?: If this flag is true, then any packages publicly imported by this package will also be searched. If the name is found in more than one imported package, a
AmbiguousNameError will be thrown. If false, only members directly defined in this package will be returned.
Description
Returns
PackageMember object representing public member of the package with the specified
name.
Returns null if no matching public member is found.
(method)
| public
| {Package.get-members check-imports?:bool = true }:{FastArray-of PackageMember} |
Returns all public members accessible through this package.
check-imports?: If this flag is true, then any packages publicly imported by this package will also be searched. If false, only members directly defined in this package will be returned.
Description
Returns an array of
PackageMember objects representing all of the public members accessible through this package.
(method)
| public
| {Package.get-nonlocal-option name:String, check-imports?:bool = true }:#Option |
Lookup nonlocal option by name.
name: The name to be looked up.
check-imports?: If this flag is true, then any packages imported by this package will also be searched.
Description
Returns
Option object representing option with the specified
name.
Returns null if no matching option is found.
(method)
| public
| {Package.get-nonlocal-options check-imports?:bool = true }:{FastArray-of Option} |
Returns all options accessible through this package.
check-imports?: If this flag is true, then any packages imported by this package will also be searched. If false, only options directly defined in this package will be returned.
Description
Returns an array of
Option objects representing all of the options accessible through this package.
(method)
Looks up a name in the package.
name: The name to be looked up.
check-imports?: If this flag is true, then any packages imported by this package will also be searched. If the name is found in more than one imported package, a
AmbiguousNameError will be thrown.
public-only?: If true, then only include public names. This is automatically set if the package is frozen.
Returns
If name is bound in the package then its value is returned as the first value with true as the second value. Otherwise null is returned as the first value and false as the second value.
Description
Note that only public names can be accessed in frozen packages even if public-only? is set to false.