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.
brianTue 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.
cheeserTue 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...
cheeser Tue 29 Sep 2009
What's wrong with this:
i get this:
ivan Tue 29 Sep 2009
Is
bot
final or const? See http://fandev.org/doc/docLang/Functions.html#immutablecheeser 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 usethis
but I still have the problem. I'm thinking that passing inthis
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:This will print true. However if
Foo
is not-const, then thef
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...