Locals
Info
Dependencies:
- StringBuilder
Implementation:
Locals.d on GitHub
Daedalus doesn't offer any local variables, which can quickly lead to problems with recursive functions. The Locals package allows variables to be saved temporarily on a pseudo-stack. Locals is a very specific package. People who work normally with Daedalus will probably never need it. There is also the final
function, which can be used to emulate something similar to the final
clause in Java.
Initialization
N/A
Functions
Locals
Locals
All that has to be done to enable the Locals
is to write this function at the beginning of the function that should receive "real" local variables.
Final
Final
It is hard to explain how to use it, but very easy to understand once you've seen an example.
Example
With final()
it is very easy to emulate Java's final
clause, i.e. a block of code can be specified, which is executed after this function is exited, regardless of when or where the function is exited.