|
Key
This line was removed.
This word was removed. This word was added.
This line was added.
|
Changes (1)
View Page History...
Voila!
There's one problem with this code, imagine the case like this:
{noformat}
const class Foo
{
@Magic { kind = ActorLocal<||> }
Str s
}
const class MyActor
{
const Foo foo1
const Foo foo2
...
override Obj? receive(Obj? msg)
{
foo1.s = "str" //now foo2.s equals to "str" too
}
}
{noformat}
And I don't really know if this can be fixed correctly. In theory, we could store map {{[Foo:FieldType]}} in {{Actor.locals}}, but there are two obstacles:
# We won't know when to remove values from this map, probably weak keys could help
# Foo must be const - only const objects can be used as map keys
However, I don't think it is a big deal, since typically such fields can be declared in actors itself and used only from {{receive}} method, so they'll act as normal instance fields.
h3. Conclusion
...