Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- actor Main
- new create(env: Env) =>
- let fox = recover Fox(env) end
- let wolf = Wolf(env, consume fox)
- wolf()
- wolf()
- class Wolf
- let _env: Env
- let fox: Fox ref
- new create(env: Env, fox': Fox iso) =>
- _env = env
- fox = consume fox'
- // v-- inserting a "ref" here fixes the issue
- fun ref apply() =>
- _env.out.print("Wolf: I'm in a ref function! 🐺")
- fox()
- class Fox
- let _env: Env
- var _x: U32 = 0
- new create(env: Env) =>
- _env = env
- fun ref apply() =>
- _x = _x + 1
- _env.out.print("Fox: I'm in a ref function, and look at my number: " + _x.string() + " 🦊")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement