at:tutorial:appendix
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
at:tutorial:appendix [2008/07/10 16:12] – * tvcutsem | at:tutorial:appendix [2008/07/10 16:22] – added tvcutsem | ||
---|---|---|---|
Line 464: | Line 464: | ||
==== Dynamic Variables ==== | ==== Dynamic Variables ==== | ||
+ | |||
+ | The module ''/ | ||
+ | |||
+ | A dynamic variable can be defined as follows: | ||
+ | < | ||
+ | def name := dynamicVariable: | ||
+ | </ | ||
+ | |||
+ | It can be read as follows: | ||
+ | < | ||
+ | ?name or name.value | ||
+ | </ | ||
+ | |||
+ | It can be assigned only within a limited dynamic scope, as follows: | ||
+ | < | ||
+ | with: name is: newval do: { code } | ||
+ | // or | ||
+ | name.is: newval in: { code } | ||
+ | </ | ||
+ | |||
+ | When '' | ||
+ | |||
+ | By convention, we prefix the names of dynamic variables with a '' | ||
+ | |||
+ | You can find more usage examples of dynamic variables in the unit test included in the file '' | ||
==== Ambient References ==== | ==== Ambient References ==== | ||
+ | |||
+ | Ambient references are defined in the module ''/ | ||
+ | |||
+ | < | ||
+ | import / | ||
+ | deftype Printer; | ||
+ | def printers := ambient: Printer; | ||
+ | </ | ||
+ | |||
+ | In the above code, '' | ||
+ | |||
+ | Ambient references ship with two so-called " | ||
==== Structural Types ==== | ==== Structural Types ==== | ||
==== Traits ==== | ==== Traits ==== |
at/tutorial/appendix.txt · Last modified: 2021/09/24 10:28 by elisag