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 [2010/05/26 19:39] – *fixed tvcutsem | at:tutorial:appendix [2020/04/28 19:47] – summary elisag | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Appendix: Libraries ====== | ====== Appendix: Libraries ====== | ||
- | In the appendix, we explain useful libraries available to the AmbientTalk/ | + | In the appendix, we explain useful libraries available to the AmbientTalk/ |
+ | |||
+ | The Ambientalk standard library ('' | ||
===== Unit Testing Framework ===== | ===== Unit Testing Framework ===== | ||
Line 392: | Line 394: | ||
The files in the '' | The files in the '' | ||
- | ==== Futures and Multifutures ==== | ||
- | === Futures === | + | |
+ | |||
+ | ==== Futures | ||
The module ''/ | The module ''/ | ||
Line 417: | Line 420: | ||
</ | </ | ||
- | Finally, the futures module also provides some auxiliary functions, of which '' | + | The '' |
+ | |||
+ | === Auxilary functions in the futures module ==== | ||
+ | |||
+ | The futures module also provides some auxiliary functions, of which '' | ||
< | < | ||
- | when: (group: [ a<-m(), b<-n() ]) becomes: { |values| | + | when: (group: [ a<-m()@FutureMessage, b<-n()@FutureMessage |
def [aResult, bResult] := values; | def [aResult, bResult] := values; | ||
... | ... | ||
Line 426: | Line 433: | ||
</ | </ | ||
- | === Multifutures === | + | Another useful auxilary function is '' |
+ | |||
+ | < | ||
+ | future: { |return| | ||
+ | // some computation | ||
+ | return(val) | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | This is actually equivalent to the slightly more verbose code: | ||
+ | |||
+ | < | ||
+ | def [fut,res] := makeFuture(); | ||
+ | try: { // some computation | ||
+ | res.resolve(val); | ||
+ | } catch: Exception using: { |e| res.ruin(e) } | ||
+ | fut; | ||
+ | </ | ||
+ | |||
+ | ==== Multifutures | ||
The module ''/ | The module ''/ | ||
Line 466: | Line 492: | ||
When the message sent to a multireference is annotated with @Due(t), the timeout is applied to the implicit multifuture, | When the message sent to a multireference is annotated with @Due(t), the timeout is applied to the implicit multifuture, | ||
+ | |||
==== Leased Object References ==== | ==== Leased Object References ==== | ||
Line 497: | Line 524: | ||
+ | ==== TOTAM ==== | ||
+ | |||
+ | The module ''/ | ||
+ | |||
+ | Please have a look to [[: | ||
==== Dynamic Variables ==== | ==== Dynamic Variables ==== | ||
Line 609: | Line 641: | ||
The files in the '' | The files in the '' | ||
+ | |||
==== Timing Utilities ==== | ==== Timing Utilities ==== | ||
Line 632: | Line 665: | ||
The timer module also defines a function '' | The timer module also defines a function '' | ||
- | The timer module defines | + | Finally, there is a variant |
+ | |||
+ | < | ||
+ | def testAsyncNearbyPlayerReply(){ | ||
+ | def nearbyPlayers := // search 2 nearby player orjbects; | ||
+ | // wait a bit so that there are the 2 members. | ||
+ | when: 2.seconds elapsedWithFuture: | ||
+ | self.assertEquals(2, | ||
+ | } | ||
+ | }; | ||
+ | </ | ||
==== Logging Framework ==== | ==== Logging Framework ==== |
at/tutorial/appendix.txt · Last modified: 2021/09/24 10:28 by elisag