[fpc-devel] Tests of observer feature [was: Considerations about observer]

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Thu Nov 29 17:33:56 CET 2012



On Thu, 29 Nov 2012, luiz americo pereira camara wrote:

> - I cannot define FieldsObserver as IFPObserver (the reasons why do i
> prefer as it are above)
> - Using FieldsObserver as TObject each time i attach/dettach from a
> TFields there will be a type cast that i know before hand is not
> necessary and could avoid.

That depends on the implementation.

Not everybody will have the IFPObserver available as a separate field.
I suspect that in many cases, it will be the observer object itself.

In that case you would have to do 
(YourObserverObject as IFPObserver)
anyway, and you gain nothing. the 'as' does the same thing as what is now in
the implementation of attachobserver...

> In my proposition, is up to programmer decide if will use TObject or
> IFPObserver in FieldsObserver, different from today that i'm tied with
> TObject.

Since every object is TObject, I do not see this as a problem.

Since in your code you will only attach a FieldsObserver, you 
lose nothing in the process.

> Different from what Michael stated in previous email, in my
> proposition there would be no increase of interface usage in the
> functionality itself. Just would be explicit to the programmer that
> this feature requires a interface rather than now, that is hidden in
> the implementation.

That it is hidden, is exactly what I wanted. To me, that is a plus.

Anyway, with this I have a clearer example of what you want to achieve.

Michael.



More information about the fpc-devel mailing list