Dmitry
You wrote in message news:
[hidden email]...
> Hello,
>
> > A method #swappingBecome: (#become: as well) does not swap events of
> > the receiver and the argument after applying. Is this by design or a
> > bug?
>
> I've added a new method to resolve this problem (?):
>
> Object>>becomeWithEvents: anObject
>...
Sorry, I had intended to reply to your initial post but it slipped my mind.
The behaviour is by design, for better or worse, and is compatible with the
behaviour of St-80 with respect to old dependency mechanism, i.e. the events
are registered against the object identity, and are not considered part of
its state. Since become: swaps the "body" of the object, and not the
identity, the events remain associated with the identity against which they
were originally registered. This means that, for example, should I register
some events against a hypothetical proxy object, then when/if that proxy is
exchanged for the real value, the events are now registered against that
value. This makes sense for a transparent proxy, although there may be other
use-cases where the opposite behaviour is desirable.
One could make arguments that it should work either way, but it should be
consistent and in that respect there is a bug in Dolphin in that objects
which provide their own event storage (i.e. they store the events collection
as part of their state) behave differently.
Regards
Blair