#764 Actors question

cheeser Tue 29 Sep 2009

What's wrong with this:

a := Actor(ActorPool()) | Channel channel | {
   channel.join(bot)
}

i get this:

Receive func not immutable: |fancore::Channel->sys::Obj|
sys::NotImmutableErr: Receive func not immutable: |fancore::Channel->sys::Obj|

ivan Tue 29 Sep 2009

cheeser Tue 29 Sep 2009

it's actually a reference to this that I thought was necessary because I'm used to anonymous inner classes. But then I remembered that closures aren't AIN so I changed it to use this but I still have the problem. I'm thinking that passing in this is the problem but I'm not sure how I'd get around it without redoing the API I'm building on.

brian Tue 29 Sep 2009

If this is const then closures which capture it will be immutable:

const class Foo
{
  Void main()
  {
    f := |,| { echo(this) }
    echo(f.isImmutable)
  }
}

This will print true. However if Foo is not-const, then the f will always be mutable.

If you can explain a bit more about what you are doing, perhaps I can offer some other suggestions.

cheeser Tue 29 Sep 2009

Perhaps we can hook up on irc later in the week and we can walk through this. I'm gonna get on a plane in the morning so I won't be around much for the next day+ or so...

Login or Signup to reply.