Closed moonheart08 closed 6 years ago
@moonheart08 I'm going to close this out. The RFC project is specifically a place to propose new features via the RFC process. You should confirm that a feature does not exist before filing an issue here.
Before I close, I'll address your question. You can pass a tag of an actor using this
. The example below does what I believe you are looking for.
use "debug"
actor Foo
be tick(bar: Bar tag) =>
Debug("ticked")
actor Bar
let _foos: Array[Foo] val
new create(foos: Array[Foo] val) =>
_foos = foos
be tick_all_foos() =>
for foo in _foos.values() do
foo.tick(this)
end
actor Main
new create(env: Env) =>
let foos = recover val [as Foo: Foo; Foo; Foo] end
let bar = Bar(foos)
bar.tick_all_foos()
If you have any other questions about this, please feel free to ask on the mailing list or in the IRC channel.
Say you have two actors, 'Bar' and 'Foo'. Bar keeps a list of Foo actors.
Foo has one function, tick(b: Bar tag), and Bar has one function, tickallfoo()
Bar needs to pass a tag of itself to all Foo, but it can't do so.
Simple concept, potentially big impact (I don't know the internals) If this actually already exists, then feel free to prod me about it, because I overlooked it pretty hard. (I spent an hour looking)