Fantom

Login | Register

Improved detection immutable closures #532

brian
15 Apr 2009

Currently the compile marks all closures in a method mutable even though there may be a mix of mutable and immutable:

class Foo
{
  Void main() 
  {
    a := Actor(ActorGroup()) |Obj m->Obj| { echo(m); return m }    
    3.times |Int i| { a.send(a) }     
  }
}

sys::NotImmutableErr: Receive func not immutable: |sys::Obj->sys::Obj|
  fan.sys.Actor.make$ (Actor.java:44)
  fan.sys.Actor.make (Actor.java:29)
  ...

brian
15 Apr 2009

Promoted to ticket #532 and assigned to brian

brian
17 May 2009

Ticket resolved in 1.0.43

Don't mark a closure immutable unless it actually captures local variables, even if other closures in that method do capture local variables.

tompalmer
18 May 2009

Sounds great, by the way. Fan's hardcore concurrency emphasis is sweet. It seems to have a really nice organization/balance of functional (i.e., immutability-oriented) and imperative features.

Login or Register to Reply

Back | All Topics