at:tutorial:modular
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:modular [2007/06/25 20:59] – tvcutsem | at:tutorial:modular [2010/07/26 15:20] – custom tvcutsem | ||
---|---|---|---|
Line 57: | Line 57: | ||
The downside of such as scheme is that the absolute path name of the '' | The downside of such as scheme is that the absolute path name of the '' | ||
- | The [[at: | + | The [[at: |
< | < | ||
Line 64: | Line 64: | ||
Whenever a new actor is created by the AmbientTalk interpreter, | Whenever a new actor is created by the AmbientTalk interpreter, | ||
+ | |||
+ | Think of AmbientTalk' | ||
< | < | ||
Line 179: | Line 181: | ||
</ | </ | ||
- | So, '' | + | So, '' |
+ | |||
+ | Note that in AmbientTalk, | ||
+ | |||
+ | < | ||
+ | def Enumerable := object: { | ||
+ | def collect: clo { /* as before */ }; | ||
+ | def detect: pred { /* as before */ }; | ||
+ | def reject: pred { /* as before */ }; | ||
+ | def each: clo @Required; | ||
+ | } | ||
+ | </ | ||
==== Resolving conflicts: exclusion and aliasing ==== | ==== Resolving conflicts: exclusion and aliasing ==== | ||
Line 190: | Line 203: | ||
// do not import the slots collect: and detect: | // do not import the slots collect: and detect: | ||
import Enumerable exclude collect:, detect: | import Enumerable exclude collect:, detect: | ||
- | // do not import collect: and import reject: as remove | + | // do not import collect: and import reject: as remove: |
- | import Enumerable alias reject: := remove exclude collect: | + | import Enumerable alias reject: := remove: exclude collect: |
</ | </ | ||
If the compositor defines an alias for an imported slot, it is good practice to ensure that the compositor has (or imports) a slot with the original name as well. That way, if the trait object performs a self-send to invoke one of its own methods, it will find a matching slot in the compositor. If the compositor aliases a slot and does not define the slot itself, a lookup by the trait of the original slot name would fail. | If the compositor defines an alias for an imported slot, it is good practice to ensure that the compositor has (or imports) a slot with the original name as well. That way, if the trait object performs a self-send to invoke one of its own methods, it will find a matching slot in the compositor. If the compositor aliases a slot and does not define the slot itself, a lookup by the trait of the original slot name would fail. | ||
+ | |||
+ | < | ||
+ | '' | ||
+ | * '' | ||
+ | * '' | ||
+ | |||
+ | Moreover, all methods of the trait object annotated with '' | ||
+ | </ | ||
===== Classifying objects using type tags ===== | ===== Classifying objects using type tags ===== | ||
Line 322: | Line 343: | ||
system.println(exc.message); | system.println(exc.message); | ||
}; | }; | ||
- | }) | + | } taggedAs: [/ |
</ | </ | ||
Line 335: | Line 356: | ||
calculateSomething(); | calculateSomething(); | ||
} catch: DivisionByZero using: { |e| | } catch: DivisionByZero using: { |e| | ||
- | system.println(e.message): | + | system.println(e.message); |
} catch: NoSolution using: { |e| | } catch: NoSolution using: { |e| | ||
calculateSomethingElse(); | calculateSomethingElse(); |
at/tutorial/modular.txt · Last modified: 2013/05/17 20:24 by tvcutsem