Elements

DefineAliasImplementAssert

Each Ocean file consists of definitions, implementations, aliasses, and assert. A definition informes the compiler/interpreter of the structure of a given component, but it does not (in theory) reserve any memory. Implementations are xxx. Aliasses are a mapping to existing implementations, but often with some automatic conversion, or extra parameters. Asserts are there to ensure that the code does what is expected. If at all possible, asserts are executed during compile time.

Define

define indicates the structure/signature of its parameter, but not its ...

Visibility in the define context means that it is visible/usable:

public
to the whole program
restricted
to just the module
private
to just this file

Implement

Visibility in the implement context means that implementation info (thus inlining) is usable:

public
in the whole program
restricted
in the module
private
in this file

Only after extensive profiling, you should use section labels. With a section label you can determine which pieces of code are placed 'near' eachother. If 80% of the work is done by 20% of the program, you can locate those most used routines near each other, improving cache use and swap patterns.

Again, this is code to be used for the final version. Only use it when it makes a measurable difference.

Alias

Visibility in the alias context means that it is visible/usable:

public
to the whole program
restricted
to just the module
private
to just this file
alias dyadic + `4lr` : add;
alias dyadic - `4lr` : minus;
alias dyadic * `3lr` : multiply;
alias dyadic / `3lr` : divide;
alias dyadic \ `3lr` : modulo;
alias dyadic ^ `2rl` : power;   # 2^2^3 = 2^8 not 4^3
alias unary  - `1` : minus;
alias function minus(my Float v1, my Integer v2, return Float v3) : minus(v1,Float(v2),v3);
alias function minus(my Float v1, my Integer v2, return Integer v3) : minus(Integer(v1),v2,v3);

Assert

Visibility in the assert context should not be used for now.