Closures
In Aqua, you can create an arrow within the function, enclosing its context.
Closures can be created anywhere in the function, starting with Aqua 0.4.1, and then used just like any other arrow (argument of arrow type, function, or service method): passed to another function as an argument, or called right there.
Closures enclose over three domains:
Values in scope,
Service resolutions,
Topology: place where the closure is defined should be the place where it's executed.
Comparing with functions, closures have one important difference: functions are detached from topology by default. func
keyword can be used to bring this behavior to closures, if needed.
It is not yet possible to return an arrow from an arrow.
Last updated
Was this helpful?