Created
May 27, 2016 19:36
-
-
Save willemneal/76757be24096dbaea31b22703c356838 to your computer and use it in GitHub Desktop.
Actor A sends a message to Actor B but it is intercepted by D. This can be generalized to have decorators that can catch messages.
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
actor A | |
let _b: B | |
let _d: D | |
let e: Env | |
new create(env: Env)=> | |
_b = B(env) | |
_d = D(env) | |
e = env | |
be messageB()=> | |
e.out.print("Calling B") | |
let b = _b | |
let f: {()} val = recover lambda()(b)=> b.foo() end end | |
_d(consume f) | |
actor B | |
let env': Env | |
new create(env: Env)=> | |
env' = env | |
be foo()=> | |
env'.out.print("In B") | |
actor D | |
let e: Env | |
new create( env:Env)=> | |
e = env | |
be apply(f: {()} val)=> | |
e.out.print("In D") | |
f() | |
actor Main | |
new create(env: Env) => | |
let a = A(env) | |
a.messageB() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment