[Pharo-project] [squeak-dev] Re: WeakRegistry>>remove: - when you'll be in trouble

Igor Stasenko siguctua at gmail.com
Mon Oct 11 02:20:00 UTC 2010


2010/10/11 Levente Uzonyi <leves at elte.hu>:
>
> The conclusion is that there is code out there which relies on having
> multiple finalizers per object. Even if that code uses a private
> WeakRegistry, one finalizer is not enough.
>

no, because if you own your private registry, you can do things like:

oldExecutor := registry remove: object.
oldExecutor ifNil:  [ .... registry add: object executor: newExecutor]
ifNotNil: [ registry add: object executor: (oldExecutor addExecutor:
newExecutor) ].

(where addExecutor: should answer an executor, which is a combination
old and new one).

so, there will be no 'multiple executors' seen by weak registry. Just one.

> Btw, what's your problem with multiple finalizers per object?
>

the problem is , that in its current form it is a best way to shoot
yourself into own foot.
(read again, why #remove: in general case are not safely applicable
with multiple finalizers/executors)).


> Levente
>



-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list