Created
January 24, 2011 05:12
-
-
Save tafsiri/792866 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Actors | |
#this code is from day 2 | |
Delay := Object clone | |
Delay send := method( | |
args := call message arguments | |
for(i,0, args size - 1, 2, | |
delay := doMessage(args at(i)) | |
msg := args at(i+1) | |
wait(delay) | |
msg doInContext(call sender) | |
) | |
) | |
Me := Object clone | |
Date asString("%H:%M:%S") println | |
#"Hello There! the time is " .. | |
Me time := method(at, "Hello There! the time is " .. at asString("%H:%M:%S") println) | |
Me delayMsgs := method(Delay send(1, time(Date now), | |
3, time(Date now), | |
5, time(Date now))) | |
#note the @@ symbol is the only thing we added to this snippet of code from day 2 | |
Me @@delayMsgs | |
#now the previous line returns immediately and we can do other things. In this case | |
#we just wait (so that we can see the output from the delay). | |
wait(10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment