Define | Alias | Implement | Assert |
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 indicates the structure/signature of its parameter, but not its ...
Visibility in the define context means that it is visible/usable:
Visibility in the implement context means that implementation info (thus inlining) is usable:
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.
Visibility in the alias context means that it is visible/usable:
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);
Visibility in the assert context should not be used for now.