ACTOR: split into bare-bones and DSL
In order to cut down on (and keep low) object allocations when creating actors, there should be two varieties:
The reason is that we will spawn many basic actors when re-implementing ask(), and those don’t need a fancy DSL, not even the current receive().
We could keep the current receive method supported (defaulting to null) and provide a default receive(Any):Boolean which delegates to that. Then everyone could live on happily in peace.
- the basic Actor, which works using overriding methods and even does not allocate a closure for “receive”
- the fancy Actor, which provides the low-level methods internally and fills in behavior a DSL (à la “uponBirth { ... }”, “uponRestart { ... }”, “become { ... }”, etc.)
The reason is that we will spawn many basic actors when re-implementing ask(), and those don’t need a fancy DSL, not even the current receive().
We could keep the current receive method supported (defaulting to null) and provide a default receive(Any):Boolean which delegates to that. Then everyone could live on happily in peace.
Leave a comment
on 2011-10-18 01:14 *
By Jonas Bonér
I like that. Good idea Roland.
on 2011-12-20 02:51 *
By Patrik Nordwall
Viktor: Adds complexity where no one is complaining.