The standard library is a set of declarations implicitly available to all Orc programs. In this section we give an informal description of the standard library, including the type of each declaration and a short explanation of its use.
Orc programs are expected to rely on the host language and environment for
all but the most essential sites. For example, in the Java implementation of
Orc, the entire Java standard library is available to Orc programs via
import class
declarations. Therefore the Orc standard library aims only
to provide convenience for the most common Orc idioms, not the complete set of
features needed for general-purpose programming.
The documentation of library functions uses special notation for types
that have dot-accessible members.
Member names of an instance of Type
are written in the form type.member
,
e.g. foo.get
refers to the get
member of an object of type Foo
.
The object type can include type parameters which are referenced by the member
type, so for example @method channel[A].get() :: A
means that
when the get
method is called on a value of type Channel[A]
,
it will return a value of type A
.
The Standard Library makes use of colored tags to quickly convey properties of library sites. The tags and their definitions are as follows:
Site Property Set
Indefinite |
A call to this site may block execution of an expression, since it is not guaranteed to always eventually publish a value or halt.
Definite |
A call to this site will never block execution of an expression, since it is guaranteed to always immediately publish a value or halt.
Pure |
Any call to this site is pure, meaning that it is deterministic, responds immediately, and has no side effects.
A call to a pure site may be textually replaced with its return value
(or replaced with stop
if the call halts) in any program context.
Idempotent |
The site is idempotent; calling it more than once on the same arguments is equivalent to calling it once on those arguments.