[fpc-devel] Considerations about observer [was: Free Pascal 2.6.2 rc1]
Graeme Geldenhuys
graeme at geldenhuys.co.uk
Wed Nov 28 10:48:57 CET 2012
On 2012-11-28 08:23, Vincent Snijders wrote:
> production code already uses it, then the production code writers must
> have taken a risk for change knowing that this was a not yet released
> feature.
+1
I thought it was a known fact that if you use FPC Trunk in production
code, you stand a very likely chance that your production code will be
broken at some point. Nothing in FPC Trunk is cast in stone.
Though I must admit, this code has been around for some time (at least
in my Inbox).
I can see where Luiz is coming from. Most Observer implementations seem
to be based on interfaces - but that is no hard and fast rule. I also
understand Michael's point that AddObserver() and AttachObserver()
doesn't need to take interfaces as a parameter. Most developers think
that all Interface code is reference counted, but this is simply not
true. eg: CORBA interfaces, which is used internally for the Observer
support in FPC.
The FPC implementation is very similar to what we have in tiOPF for many
years, and there it works very well. Though in tiOPF the
AttachObserver() and DetachObserver() parameters are a class type we
know supports the the observer interface. In FPC this is not the case,
though still not a show-stopper. You simply need to double check with a
few Supports(obj, IFPObserved, intf) calls where needed.
Luiz, could you produce a small sample application (or show the code you
are working on for Lazarus) where you think the current FPC Observer
implementation doesn't work. Your initial bug report doesn't include any
test project to show the issue.
Regards,
- Graeme -
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/
More information about the fpc-devel
mailing list