at:tutorial:modular
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| at:tutorial:modular [2008/09/17 17:13] – added tvcutsem | at:tutorial:modular [2013/05/17 20:24] (current) – adjusted tvcutsem | ||
|---|---|---|---|
| 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 117: | Line 119: | ||
| In this section, we describe how the '' | In this section, we describe how the '' | ||
| + | |||
| ==== import as trait composition ==== | ==== import as trait composition ==== | ||
| Line 160: | Line 163: | ||
| }; | }; | ||
| def each: clo { | def each: clo { | ||
| - | start.to: end do: clo | + | start.to: end-1 do: clo |
| }; | }; | ||
| }; | }; | ||
| Line 181: | Line 184: | ||
| So, '' | So, '' | ||
| - | Note that in AmbientTalk, | + | Note that in AmbientTalk, |
| < | < | ||
| def Enumerable := object: { | def Enumerable := object: { | ||
| - | def collect: clo { /* as before */ } | + | def collect: clo { /* as before */ }; |
| - | def detect: pred { /* as before */ } | + | def detect: pred { /* as before */ }; |
| - | def reject: pred { /* as before */ } | + | def reject: pred { /* as before */ }; |
| def each: clo @Required; | def each: clo @Required; | ||
| } | } | ||
| Line 264: | Line 267: | ||
| Type tags can best be compared to empty Java interface types. Such empty interfaces are sometimes used in Java purely for the purposes of marking an object. Examples are '' | Type tags can best be compared to empty Java interface types. Such empty interfaces are sometimes used in Java purely for the purposes of marking an object. Examples are '' | ||
| </ | </ | ||
| + | |||
| ==== Native Type Tags ==== | ==== Native Type Tags ==== | ||
| - | The module ''/ | + | The module ''/ |
| < | < | ||
| - | is: 1 taggedAs: / | + | is: 1 taggedAs: /.at.lang.types.Number |
| >> true | >> true | ||
| - | is: " | + | is: " |
| >> true | >> true | ||
| </ | </ | ||
| - | The type ''/ | + | The type ''/ |
| ==== Type tags as annotated message sends ==== | ==== Type tags as annotated message sends ==== | ||
| Line 288: | Line 292: | ||
| In the [[at: | In the [[at: | ||
| + | |||
| ===== Exception Handling ===== | ===== Exception Handling ===== | ||
| Line 311: | Line 316: | ||
| </ | </ | ||
| - | Note that a new instance of an object named '' | + | Note that a new instance of an object named '' |
| < | < | ||
| - | deftype DivisionByZero <: lobby.at.types.Exception; | + | deftype DivisionByZero <: lobby.at.lang.types.Exception; |
| - | def XDivisionByZero := lobby.at.exceptions.createException(DivisionByZero); | + | def XDivisionByZero := lobby.at.lang.exceptions.createException(DivisionByZero); |
| </ | </ | ||
| Line 341: | Line 346: | ||
| system.println(exc.message); | system.println(exc.message); | ||
| }; | }; | ||
| - | }) | + | } taggedAs: [/ |
| </ | </ | ||
| Line 371: | Line 376: | ||
| def contains(tbl, | def contains(tbl, | ||
| { |return| | { |return| | ||
| - | 1.to: tbl.length | + | 1.to: tbl.length do: { |i| |
| if: (tbl[i] == elt) then: { | if: (tbl[i] == elt) then: { | ||
| return(true) | return(true) | ||
at/tutorial/modular.1221664409.txt.gz · Last modified: (external edit)
