2012/11/27 Michael Van Canneyt <mich...@freepascal.org>:
>
>
> On Tue, 27 Nov 2012, luiz americo pereira camara wrote:
>
>>
>> Hi, i requested a change to observer interface with some
>> considerations in http://bugs.freepascal.org/view.php?id=23394
>
>
> It will not happen.
>
> If you want to pass around interfaces safely, then you need to implement
> them as
> descendents of IUnknown to maintain reference counts. They are implemented
> as CORBA interfaces exactly to avoid the overhead of IUnknown.
>
> The consequence is that you must pass around the objects themselves.

I don't see the point.

It would be true if the IFPObserved (e.g., TPersistent) takes
ownership of the attached observers. That is not the case.

Currently, in the observer feature, there's no difference between
plain TObject and corba interface (IFPObserver) regarding the life
cycle management.

Both there are no guarantees that they will still be alive when accessed.

The current approach limits the programmer flexibility and adds
unnecessary overhead.

As practical example take a LCL Form that is supposed to be observed.
It takes an Observer property and attach it to certain child controls
(TEdit etc)

1) Currently i'm forced to declare as the Observer property as an
TObject. If i declare Observer property as IFPObserver i cannot attach
to children controls.

2) Each time i attach to a child control this Observer property will
be queried to see if implements IFPObserver (but we already know that
it implements, we already checked !!!)

_Every_ time a child control notify it's observers _each_ observer
will be checked again if implements IFPObserver (it would not even be
there if not's the case!!!)

To detach the observer is the same: is checked if implements
IFPObserver yet another time

So, i keep my points. Even because is not a big change with easy
implementation that will fix the above issues.

PS: please at least consider my points. The impression is that you
even did not read my considerations, just took your previous
conclusions and throw away after reading the title.

I'm just trying to help make a better design.

Luiz
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to