Introduction
The Alore standard library provides many useful services that you can use in your programs. This reference manual contains descriptions of all standard Alore modules. If you are just starting to learn Alore, start with Introduction to Alore. It contains a short overview of the standard library. After that, come back to this document for the details.
Notation
This section gives an overview of the notation used in the library reference.
Type annotations
Descriptions of functions, types and variables usually include type annotations. For example, consider the definition of function std::Chr:
The function header indicates that Chr accepts a single integer argument (due to as Int), and it returns a string (due to as Str).
Container types such as Array have a type argument (or arguments) within < and > that indicates the type of items; for example Array<Str> stands for an array of strings, and Map<Int, Str> stands for a map from integers to strings.
Operations
The type signatures of operations involving operators such as +, * or [] use a special notation for clarity. For example, consider the + operation for strings:
This means that you can add two string objects, and the result is a string. The first part (x + y) indicates the kind of the operation, and the second part indicates the types of the operands and the result (Str + Str ⇒ Str). The actual implementation method can be derived from the above description; in this case it is _add (the base type is Str):
- _add(y as Str) as Str
Indexed array assignment is a more complex example:
Again the left part tells us that this is an indexed assignment operation. The second part says that if the base object has type Array<T> (for any T), and if the index has type Int, the rvalue must have type T (or any type that is compatible with T). We know that T can be replaced with any type from the definition of Array: it is given as Array<T>, which tells that T is a type variable.
Multiple function signatures
If a function or an operation is given multiple descriptions or signatures, it has an intersection type (which is similar to function overloading in other languages). For example, std::Abs has two signatures:
It is not important to understand the details of intersection types to use these kinds of functions or operations.