Abilities
Abilities are a way to organize code in modules and implement inversion of control pattern in Aqua.
Ability is a product of scalars, structures, arrows and other abilities.
aqua
aqua
Creating abilities
Abilities could be created inside functions just like structures.
aqua
aqua
Passing abilities
Abilities could be passed to and returned from functions, althrough they require special syntax:
- Abilities required by function are listed before arguments without names
- Abilities returned by function are listed in return types just as any other types
aqua
aqua
Why abilities are special
Abilities are fully resolved in compile time and do not affect runtime by any means. In this sense they are more like a context or trait implementation in other languages. For this reason special syntax is used.
Limitations
As abilities do not exist in runtime, they could not be put into a collection.