Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2012-10

Observer support in Delphi

17 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

luiz americo pereira camara

While looking for the new TextHint property in Delphi docs, i found that recent Delphi implements Observer support. See:

http://docwiki.embarcadero.com/Libraries/XE3/en/System.Classes.TComponent.Observers

http://docwiki.embarcadero.com/Libraries/XE2/en/System.Classes.TObservers_Methods

Recently observer support was added to fpc.

Just wondering what path fpc will follow:

1) Ditches the current fpc implementation and implements a Delphi compatible interface

2) Time to diverge from Delphi. Keeps fpc own implementation

3) Implement both interfaces

Luiz

Reply by email

Unknown author
to luiz americo pereira camara
luiz americo pereira camara wrote 17 lines
While looking for the new TextHint property in Delphi docs, i found that recent Delphi implements Observer support. See: http://docwiki.embarcadero.com/Libraries/XE3/en/System.Classes.TComponent.Observers http://docwiki.embarcadero.com/Libraries/XE2/en/System.Classes.TObservers_Methods Recently observer support was added to fpc. Just wondering what path fpc will follow: 1) Ditches the current fpc implementation and implements a Delphi compatible interface 2) Time to diverge from Delphi. Keeps fpc own implementation 3) Implement both interfaces

Probably 3.
However, given the total lack of documentation, it is hard to say.

Michael.

Reply by email

Unknown author
to Graeme Geldenhuys
Graeme Geldenhuys wrote 8 lines
On 2012-10-24 07:52, wrote: > However, given the total lack of documentation, it is hard to say. +1 I had a look too, the Embarcadero website isn't much help. From what I've seen, I can surmise it is geared towards their 'livebindings' feature.

Seeing things like

http://docwiki.embarcadero.com/Libraries/XE3/en/System.Classes.TLinkObservers.EditGridLinkEdit

in the classes (!) unit, makes me shudder, though.

How anyone can create such a convoluted system is beyond me.

Michael.

Reply by email

Marco van de Voort
to Unknown author: Probably 3. However, given the total lack of documentation, it is hard to say. Michael.

In our previous episode, said:

Show quoted text 13 lines
> Recently observer support was added to fpc. > > Just wondering what path fpc will follow: > > 1) Ditches the current fpc implementation and implements a Delphi > compatible interface > > 2) Time to diverge from Delphi. Keeps fpc own implementation > > 3) Implement both interfaces Probably 3. However, given the total lack of documentation, it is hard to say.

I can still unmerge the observer functionality from fixes/2.6.2. Then (1) is also still a possibility.

Reply by email

Unknown author
to Marco van de Voort
Marco van de Voort wrote 17 lines
In our previous episode, said: >> Recently observer support was added to fpc. >> >> Just wondering what path fpc will follow: >> >> 1) Ditches the current fpc implementation and implements a Delphi >> compatible interface >> >> 2) Time to diverge from Delphi. Keeps fpc own implementation >> >> 3) Implement both interfaces > > Probably 3. > However, given the total lack of documentation, it is hard to say. I can still unmerge the observer functionality from fixes/2.6.2. Then (1) is also still a possibility.

Not if I have anything to say about it :-)

Michael.

Reply by email

Sven Barth
to Unknown author: Seeing things like http://docwiki.embarcadero.com/Libraries/XE3/en/System.Classes.TLinkObs…

Am 24.10.2012 10:59, schrieb

Show quoted text 22 lines
On Wed, 24 Oct 2012, Graeme Geldenhuys wrote: > On 2012-10-24 07:52, wrote: >> However, given the total lack of documentation, it is hard to say. > > +1 > > I had a look too, the Embarcadero website isn't much help. > From what I've seen, I can surmise it is geared towards their > 'livebindings' feature. Seeing things like http://docwiki.embarcadero.com/Libraries/XE3/en/System.Classes.TLinkObservers.EditGridLinkEdit in the classes (!) unit, makes me shudder, though. How anyone can create such a convoluted system is beyond me.

If they continue like that we really need to think how long we want to follow their path... (and yes, I also wouldn't want to find that in our Classes unit...)

Regards,
Sven

Reply by email

luiz americo pereira camara
to Graeme Geldenhuys: +1 I had a look too, the Embarcadero website isn't much help. - Graeme -

2012/10/24 Graeme Geldenhuys

Show quoted text 8 lines
On 2012-10-24 07:52, wrote: > However, given the total lack of documentation, it is hard to say. +1 I had a look too, the Embarcadero website isn't much help.

First some considerations:

- Initially i questioned the fpc obsever support, now i see as a good
implementation

- I think Delphi compatility important

- We don't have much info about the Delphi implementation since is not properly documented (i would bet it was introduced to support the Live Bindings)

When i asked, i did not have any preference of any interface, the only option that i would have objections was 3 (two implementations) since would have overlapping features with possible overhead (two observer lists per component?) at base classes

Given that fpc one is good enough, and Delphi one is at minimal obscure, i would consider break the "Delphi compatibility/feature parity" and stay with fpc one. Of course, if the Delphi one shows somehow to be technically better it's also a option to stay with it. But never the two.

Regarding Delphi compatibility, currently fpc already lacks much features in areas like attributes, anounimous methods, generics, interfaces, unicode and some will never can be (or not) a start point to depart from playing "Delphi catch up" at all cost and port only the features that matches the fpc direction (whatever it is)

Luiz

Reply by email

Sven Barth
to luiz americo pereira camara

Am 25.10.2012 01:55 schrieb "luiz americo pereira camara" <

: Regarding Delphi compatibility, currently fpc already lacks much features

in areas like attributes, anounimous methods, generics, interfaces, unicode and some will never attributes are being worked on
- for anonymous methods exists a branch with an initial implementation though this is currently on hiatus :(
- generics is being worked on (constraints are nearly finished, generic methods are planned next)
- what do you miss for interfaces?
- Unicode support is being worked on
(- extended RTTI is on my ToDo list)
(- for type helpers I have already done a first proof of concept implementation)
(- dynamic packages is currently not being worked on, but nevertheless planned for the future)

This can be (or not) a start point to depart from playing "Delphi catch

up" at all cost and port only the features that matches the fpc direction (whatever it is)

I believe the final diversion will take place if Embarcadero really implements a new compiler that throws away much backwards compatibility (as is currently suggested by things like the string helper, 0-based strings and reference counted class instances)

Regards,
Sven

Reply by email

Graeme Geldenhuys
to luiz americo pereira camara: 2012/10/24 Graeme Geldenhuys First some considerations: - Initially i questioned the fpc…
luiz americo pereira camara wrote
- Initially i questioned the fpc obsever support, now i see as a good implementation

The FPC Observer and Mediator is based on works found in the tiOPF framework - done a few years ago. And that in turn was based on a implementation I done for our company back in 2005. The design and functionality has a long history, is well tested in production software
- so yes, it is good. ;-)

- ... (i would bet it was introduced to support the Live Bindings)

Yes I would imagine so. The tiOPF Observer & Mediator implementation is the basis for our company's "live bindings", which we call Model-GUI-Mediator (very similar to Model-View-Controller). This was long before Delphi had Live Binding support. We have been using the tiOPF implementation for 7 years in all our products, and all our application's UI is Observer/Mediator driven. There isn't a single DB-aware component in sight. I can hook up any gui control to a data/business object property with a single line of code, and have 2-way updates with no extra work.

Michael even took the tiOPF idea and built a non-tiOPF based design-time support for Lazarus (this is where the current FPC Observer/Mediator comes in) - though the design-time code was never contributed to the Lazarus project. I'm sure he will at some point.

Anyway, to make a long story short. The current FPC Observer/Mediator is a good design and very flexible with what it can offer. The Lazarus project could very easily use this to implement their own "live bindings" support. It could even make DB-aware components obsolete (optional).

(two implementations) since would have overlapping features with possible overhead (two observer lists per component?) at base classes

Yes indeed, having two implementations in FPC would definitely not be a good idea!

Graeme.

Reply by email

patspiper
to Sven Barth: Am 25.10.2012 01:55 schrieb "luiz americo pereira camara" < in areas like attributes,…
Sven Barth wrote 15 lines
Am 25.10.2012 01:55 schrieb "luiz americo pereira camara" < >: > Regarding Delphi compatibility, currently fpc already lacks much features in areas like attributes, anounimous methods, generics, interfaces, unicode and some will never land at fpc. - attributes are being worked on - for anonymous methods exists a branch with an initial implementation though this is currently on hiatus :( - generics is being worked on (constraints are nearly finished, generic methods are planned next) - what do you miss for interfaces? - Unicode support is being worked on

Can you elaborate on unicode support? IIRC, there were many discussions without any conclusion.

Stephano

Reply by email

luiz americo pereira camara
to Sven Barth: Am 25.10.2012 01:55 schrieb "luiz americo pereira camara" < in areas like attributes,…

2012/10/25 Sven Barth

Show quoted text 10 lines
Am 25.10.2012 01:55 schrieb "luiz americo pereira camara" < >: > Regarding Delphi compatibility, currently fpc already lacks much features in areas like attributes, anounimous methods, generics, interfaces, unicode and some will never land at fpc. - for anonymous methods exists a branch with an initial implementation though this is currently on hiatus :(

If i remember correct, core developers stated in mail list discussion that it was unlikely to be implemented in fpc since diverges from pascal style coding

- generics is being worked on (constraints are nearly finished, generic methods are planned next)

Good

- what do you miss for interfaces?

Delegation: http://bugs.freepascal.org/view.php?id=4842

BTW: i just hope that this new syntax features does not affect the generated code for those not using it

Luiz

Reply by email

Sven Barth
to luiz americo pereira camara
luiz americo pereira camara wrote 20 lines
2012/10/25 Sven Barth < > Am 25.10.2012 01:55 schrieb "luiz americo pereira camara" < >: > Regarding Delphi compatibility, currently fpc already lacks much features in areas like attributes, anounimous methods, generics, interfaces, unicode and some will never land at fpc. - for anonymous methods exists a branch with an initial implementation though this is currently on hiatus :( If i remember correct, core developers stated in mail list discussion that it was unlikely to be implemented in fpc since diverges from pascal style coding

Here you need to remember the point of a open source project: if there is someone who wants it implemented then he/she can implement it. This was the case here: Some community member stepped up and started to implement anonymous methods, but then either his time or his motivation left him...

Please note that it was the same with me: I wanted to see class helpers implemented which I did. And now see where I am: I'm the one who mainly works on generics (and helper types) and have also revived a platform thought lost forever...

Show quoted text 5 lines
- what do you miss for interfaces? Delegation: http://bugs.freepascal.org/view.php?id=4842

I personally don't consider this a missing feature (after all delegation itself works already), but more a bug...

BTW: i just hope that this new syntax features does not affect the generated code for those not using it

Most of the features should not influence you. Only affecting changes might be the extended RTTI (increase in executable size if enabled - and for the RTL units it might need to be enabled) and if the switch from AnsiString to UnicodeString should come...

Regards,
Sven

Reply by email

Sven Barth
to patspiper: Can you elaborate on unicode support? IIRC, there were many discussions without any…
patspiper wrote 18 lines
On 25/10/12 09:50, Sven Barth wrote: > > Am 25.10.2012 01:55 schrieb "luiz americo pereira camara" > < >: > > Regarding Delphi compatibility, currently fpc already lacks much > features in areas like attributes, anounimous methods, generics, > interfaces, unicode and some will never land at fpc. > > - attributes are being worked on > - for anonymous methods exists a branch with an initial > implementation though this is currently on hiatus :( > - generics is being worked on (constraints are nearly finished, > generic methods are planned next) > - what do you miss for interfaces? > - Unicode support is being worked on > Can you elaborate on unicode support? IIRC, there were many discussions without any conclusion.

You are basically right with your "many discussions without any conclusions", but the code page aware string IS implemented and in a seperate branch the RTL is prepared to handle that (and UnicodeString) correctly. So that in the future at least from a technical point nothing would stop us from switching the default string type to UnicodeString (that it won't be that easy practically is a different topic...).

Regards,
Sven

Reply by email

luiz americo pereira camara
to Sven Barth: Here you need to remember the point of a open source project: if there is someone who…

2012/10/25 Sven Barth

Show quoted text 11 lines
Am 25.10.2012 14:11, schrieb luiz americo pereira camara: - what do you miss for interfaces? > Delegation: http://bugs.freepascal.org/view.php?id=4842 I personally don't consider this a missing feature (after all delegation itself works already), but more a bug...

Feature or a bug, it prevents Delphi components (compilable with Delphi 7) from being ported.

Show quoted text 7 lines
BTW: i just hope that this new syntax features does not affect the generated code for those not using it Most of the features should not influence you.

Hey, who said i'll not be using it? ;-)

I even reported a missing generic feature (or bug): http://bugs.freepascal.org/view.php?id=20503

When i use such features i have an idea of the increase in code size etc ( http://lazarusroad.blogspot.com.br/2012/06/cost-of-using-generics.html ) so i can balance the pros and cons. I just don't want to be surprised if i dont use.

Some people use the new syntaxes like class helper and have no idea what is behind the courtain to get it working

Luiz

Reply by email