structure ComponentManager : COMPONENT_MANAGER signature COMPONENT_MANAGER
A component manager is responsible for loading and linking components. To this aim, every component manager maintains its component table, which is a mapping from URLs to components. All loading, linking, evaluating, and signature matching is performed lazily. For this reason components are initially returned as lazy futures, which either get replaced by the component export (on success) or failed. See the description of exception Component.Failure to see how these "asynchronous" exceptions are handled.
URLs given to any of the functions below are first resolved with respect to the current working directory and stripped of their query and fragment constituents.
The structure ComponentManager is the root component manager.
import signature COMPONENT_MANAGER from "x-alice:/lib/system/COMPONENT_MANAGER-sig"
signature COMPONENT_MANAGER = sig exception Conflict functor Eval(val component : Component.t val url : Url.t signature S) : S functor Link(val url : Url.t signature S) : S functor Enter(val url: Url.t signature S structure X : S) : any val link : Url.t -> Component.t val enter : Url.t * Component.t -> unit val lookup : Url.t -> Component.t option val start : Url.t -> unit end
indicates an attempt to enter a component in the component table while some component was already registered under that name.
evaluates comp, rooted at url, in the context of the component table managed by this component manager, and returns the computed structure. Raises Component.Mismatch if the computed structure does not match S, after evaluating the declarations contained in comp. Note that no entry for url is created in the component table, but entries may be created for components imported (directly or indirectly) by comp. Relative import URLs in comp are resolved using url as a base url, which should be absolute.
returns a new by-need future that, when triggered, causes the component from url to be linked and evaluated and its signature to be matched against S. The future is then bound to the structure computed by the component. If the component table has no entry for url yet, a new entry is created immediately.
enters an evaluated component with export structure X of signature S into the component table, under name url. Raises Conflict if the component table already had an entry for url.
returns a new by-need future that, when triggered, causes the component from url to be linked and evaluated. The future is then bound to the component. If the component table has no entry for url yet, a new entry is created immediately.
enters comp into the component table, under name url. Raises Conflict if the component table already had an entry for url.
returns SOME comp, if the component table has an entry mapping url to comp, or NONE otherwise.
links and evaluates the component at url eagerly. Raises Component.Failure if this fails.