Reference Manual
Data Types
Aluminium tries to be type agnostic – it doesn't know what types of data are being passed to the operations. Although, operations usually expect arguments to be of certain types (e.g. a file name should be text, a script in a script operation might use a list, etc.), so a notion of data type and structure does exist. There are several common data structures:
- Simple value
- A value of any type (number, text string, binary object, date, ...).
- List
- An ordered list of data items (simple values, lists, records, etc.). Items in a list can be of different types/forms. The items are enumerated, starting with 0.
- Record
- A record is similar to a list, except it's items (or fields) are identified by names instead of numbers.
- Table
- A table is basically a record, which contains fields that contain lists of items.
Operations And Arguments
As stated in the overview, an operation is basically a function that takes a number of named arguments, and returns a value. An argument can be a static constant, or another operation. In the later case, when an operation tries to access an argument, the corresponding argument operation is executed, and it's result is used (lazy evaluation principle).
An operation must not be used as argument for more than one time. This rule applies to all operations except split (which is designed to provide a way of reusing operation results).
There are two types of operation arguments: operation specific, and user defined. Operation specific argument names start with a colon (:) – most operations work only with those. Some operations accept user defined arguments, in which case the developer can choose any string as it's name (although it's a good idea to use the same naming rules as in most conventional programming languages).
It is possible to perform simple transformations of arguments, before they reach the operation, in two ways:
- Using asterisk (*) as argument name instructs the interpreter to assume that the value that is being passed is a record, and split it into separate fields, passing each field as a separate argument (using the field names as argument names).
- Argument transformation, which can be specified on argument connection, is interpreted as a field name, or a list index, and used by the interpreter to select the corresponding field from the value (which must be a record or a list) and pass it's value instead of the whole structure.
Tags And References
A tag is a text string that can be associated with any code element (except connections). A single tag can be associated with many items; an item can have many different tags associated with it.
A tag reference is a code element that represents the items that are tagged with the corresponding tag. If you pass an argument to a tag reference, it will be the same as if you passed the argument to the referred items. If you use a tag reference as an argument, the referred item will be used instead (if there is more than one such item, the behaviour is undefined).
It's also possible to tag the tag references and create tag references that represent other tag references. Though this feature should be used carefully if at all, as it leads to great complexity of code, and a possibility of making infinite reference loops (which will probably crash the compiler at this moment).
Routines
The "runnable" code (the *.al files) is generated separately for every routine, by taking code elements from the code diagrams. There are several rules that describe how the code elements are picked for each routine:
- A code element will be included into routine if it's marked as a member of that routine.
- If a code element has at least one routine mark, it will be included only into those routines, and not in any other, ignoring any dependencies.
- If a code element is not marked as a member of any routine, it will be included into routines that already have items that depend on this element.
Code element A is considered to be an element that element B depends on (i.e. A will be included into routine if B is already included) when:
- A is used as a direct argument of B.
- B is used as a direct argument of A.
- B is a tag reference, that refers to element A, and it's option Ignore referred items is not checked.
- A is a tag reference, that refers to element B, and it's option Include on tag use is checked.