#1808 Actor closure with enclosed variables

dobesv Mon 5 Mar 2012

Was looking at the Actor stuff a bit and I wondered: if you construct an actor with a closure that uses some local variables, does that mean you would be able to share state between threads using that closure? Or is it going to check at some point to make sure your closure doesn't modify anything?

KevinKelley Mon 5 Mar 2012

Actor is a const class, and its receive closure has to be immutable.

brian Mon 5 Mar 2012

The compiler and runtime use special rules to determine if functions are immutable. See http://fantom.org/doc/docLang/Functions.html#immutable.

dobesv Tue 6 Mar 2012

Ah right, I should have guessed. Thanks.

Login or Signup to reply.