signature COMPONENT structure Component : COMPONENT
This structure provides components as first-class entities and operations on them. We speak of unevaluated and evaluated components. An unevaluated component is a component which has not yet been linked and applied, that is, its declarations have not been executed. An evaluated component is similar to a package: it has empty import announcements, cannot be applied to produce side-effects, and as such is just a pair of a structure and its (export) signature.
The linking and evaluation of components takes place in component managers.
If the environment variable ALICE_TRACE_COMPONENT is set, then trace messages concerning link failures of native components and type-checking and evaluation of components will be printed to the standard error output stream TextIO.stdErr.
See also: COMPONENT_MANAGER, Resolver, Package, Pickle
import structure Component from "x-alice:/lib/system/Component" import signature COMPONENT from "x-alice:/lib/system/COMPONENT-sig"
signature COMPONENT = sig type component type t = component exception Sited exception Corrupt exception NotFound exception Mismatch of {component : Url.t, request : Url.t option, cause : Inf.mismatch} exception Eval of exn exception Failure of Url.t * exn val extension : string val defaultResolver : Resolver.t functor Create(signature S structure X : S) : (val component : component) val load : Url.t -> component val save : string * component -> unit val inf : component -> Inf.t option functor MkManager(val resolver : Resolver.t) : COMPONENT_MANAGER end
The type of first-class components.
used by the save operation to indicate that a first-class component contains sited data structures. This exception is never raised directly; it only appears as the cause of an IO.Io exception.
used by the load operation to indicate that the contents of a file did not represent a well-formed pickled component. This exception is never raised directly; it only appears as the cause of an IO.Io exception.
used by the load operation to indicate that a component could not be located. This exception is never raised directly; it only appears as the cause of an IO.Io exception.
indicates a signature mismatch during dynamic linking. component is the URL of the component whose export signature did not meet the requirements of the requestor given by request. A requestor of NONE indicates a request made programmatically. The cause is the mismatch reported by the used signature-checking facility.
indicates that a component raised an exception during initialization, that is, while its declarations were being evaluated. This is never raised directly, but packaged in a Failure exception instead.
indicates that the loading, evaluation or type checking of a component failed. The URL is that of the component. If loading failed, the exception is an IO.Io exception. If evaluation failed, the exception is an Eval exception. If signature matching failed, the exception is a Mismatch exception.
is the string used on the current platform as extension part to name files containing pickled components. This does not include the period commonly used to separate file names' base and extension parts.
is a resolver initialized by alicerun from the ALICE_LOAD_PREFIX and ALICE_LOAD_SUFFIX environment variables. defaultResolver is a memoizing resolver with the name "load". It is the resolver used by load.
returns an evaluated component (as val component of the resulting structure) representing structure X with export signature S.
localizes url using defaultResolver and attempts to unpickle a first-class component from the file found, which it returns upon success. Raises IO.Io if resolving, loading or unpickling fails.
pickles comp and saves it to a new file with name s. Raises IO.Io if pickling or saving fails.
retrieves the export signature from comp. May return NONE if the component represented by comp has no explicit export signature, as may be the case for a native or foreign component (that is, a component not implemented in Alice).
returns a new component manager with a component table empty but for the virtual machine's built-in components and those components that had to be loaded to initialize the system's boot component manager. The returned component manager uses resolver to locate its components.