Sign in Join

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

Mailing lists / lazarus / 2003-11

compile error on New Sources from cvs

23 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

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

Harald Rinker

Hello,
today i make a cvs update but after make i get the following errors:

gtklclintfh.inc(31,10) Error: There is no method in an ancestor class to be overridden: TGTKOBJECT.CHECKMENUITEM(ulong,LONGINT,boolean) gtklclintfh.inc(33,10) Error: There is no method in an ancestor class to be overridden: TGTKOBJECT.ENABLEMENUITEM(ulong,LONGINT,boolean) gtkint.pp(304,1) Fatal: There were 2 errors compiling module, stopping make[3]: *** [interfaces.ppu] Error 1
make[3]: Leaving directory `/usr/share/lazarus/lcl/interfaces/gtk' make[2]: *** [gtk_all] Error 2
make[2]: Leaving directory `/usr/share/lazarus/lcl/interfaces' make[1]: *** [interfaces] Error 2
make[1]: Leaving directory `/usr/share/lazarus/lcl' make: *** [lcl] Error 2

is this a feature or a bug

greets harry

Reply by email

Marc Weustink
to Harald Rinker
Harald Rinker wrote 17 lines
Hello, today i make a cvs update but after make i get the following errors: gtklclintfh.inc(31,10) Error: There is no method in an ancestor class to be overridden: TGTKOBJECT.CHECKMENUITEM(ulong,LONGINT,boolean) gtklclintfh.inc(33,10) Error: There is no method in an ancestor class to be overridden: TGTKOBJECT.ENABLEMENUITEM(ulong,LONGINT,boolean) gtkint.pp(304,1) Fatal: There were 2 errors compiling module, stopping make[3]: *** [interfaces.ppu] Error 1 make[3]: Leaving directory `/usr/share/lazarus/lcl/interfaces/gtk' make[2]: *** [gtk_all] Error 2 make[2]: Leaving directory `/usr/share/lazarus/lcl/interfaces' make[1]: *** [interfaces] Error 2 make[1]: Leaving directory `/usr/share/lazarus/lcl' make: *** [lcl] Error 2 is this a feature or a bug

The interface spect just changed. The win32 vversion is already adapted. The gtk version needs some work.

Marc

Reply by email

Marc Weustink
to Harald Rinker: today i make a cvs update but after make i get the following errors:…
Marc Weustink wrote 21 lines
At 20:00 25-11-2003, Harald Rinker wrote: >Hello, >today i make a cvs update but after make i get the following errors: > >gtklclintfh.inc(31,10) Error: There is no method in an ancestor class to be >overridden: TGTKOBJECT.CHECKMENUITEM(ulong,LONGINT,boolean) >gtklclintfh.inc(33,10) Error: There is no method in an ancestor class to be >overridden: TGTKOBJECT.ENABLEMENUITEM(ulong,LONGINT,boolean) >gtkint.pp(304,1) Fatal: There were 2 errors compiling module, stopping >make[3]: *** [interfaces.ppu] Error 1 >make[3]: Leaving directory `/usr/share/lazarus/lcl/interfaces/gtk' >make[2]: *** [gtk_all] Error 2 >make[2]: Leaving directory `/usr/share/lazarus/lcl/interfaces' >make[1]: *** [interfaces] Error 2 >make[1]: Leaving directory `/usr/share/lazarus/lcl' >make: *** [lcl] Error 2 > >is this a feature or a bug The interface spect just changed. The win32 vversion is already adapted. The gtk version needs some work.

Fixed

Reply by email

Mattias Gaertner
to Harald Rinker: today i make a cvs update but after make i get the following errors:…
Show quoted text 24 lines
At 20:09 25-11-2003, Marc Weustink wrote: >At 20:00 25-11-2003, Harald Rinker wrote: >>Hello, >>today i make a cvs update but after make i get the following errors: >> >>gtklclintfh.inc(31,10) Error: There is no method in an ancestor class to >be>overridden: TGTKOBJECT.CHECKMENUITEM(ulong,LONGINT,boolean) >>gtklclintfh.inc(33,10) Error: There is no method in an ancestor class to >be>overridden: TGTKOBJECT.ENABLEMENUITEM(ulong,LONGINT,boolean) >>gtkint.pp(304,1) Fatal: There were 2 errors compiling module, stopping >>make[3]: *** [interfaces.ppu] Error 1 >>make[3]: Leaving directory `/usr/share/lazarus/lcl/interfaces/gtk' >>make[2]: *** [gtk_all] Error 2 >>make[2]: Leaving directory `/usr/share/lazarus/lcl/interfaces' >>make[1]: *** [interfaces] Error 2 >>make[1]: Leaving directory `/usr/share/lazarus/lcl' >>make: *** [lcl] Error 2 >> >>is this a feature or a bug > >The interface spect just changed. The win32 vversion is already adapted. >The gtk version needs some work. Fixed

I broke several unnecessary unit circles. Can someone of the win32 people check, if the win32 intf compiles? My cross-compile is currently broken.

Mattias

Reply by email

Mattias Gaertner
to Harald Rinker: today i make a cvs update but after make i get the following errors:…
Show quoted text 10 lines
Mattias Gaertner wrote: > By using the the uses section in the implementation section you created > some circles. This is allowed, but it makes the code harder to structure > and less readable. They are allowed, but IMO you should try to avoid > them. I find the current approach less readable: extra units (menutype in this case), extra definitions (TBaseMenuItem), unnecessary casting from TBaseMenuItem to TMenuItem, while we know it is a TMenuItem.

see below

Show quoted text 7 lines
IMHO, the interface hierarchy is like this: high - lcl (delphi compatible) interface - generic platform independant interface - lcl itself: controls, stdctrls, etc. low - lcl type definitions

I think we are talking about the same thing. Maybe a little bit more clear:

interface
.. uses ..
LCL
.. uses ..
interface base
.. uses ..
base types

IMPORTANT:
In the following context, the "LCL" is the lazarus component library. That means the OO components and not the interface functions.

Reply by email

Micha Nelissen
to Harald Rinker: today i make a cvs update but after make i get the following errors:…
Mattias Gaertner wrote 18 lines
On Thu, 27 Nov 2003 21:38:25 +0100 Micha Nelissen wrote: >You've made a good point here. However it has problems: >1) It assumes that all interfaces need the same information for doing >the same thing, so we can pass exactly that information. This assumption >is false as proven by recent CheckMenuItem. If, and I hope when, the qt >interface is going to be implemented it may need other kinds of >information currently not passed through the parameters. I never assumed, that we pass all needed information as direct params. Only the needed information. The interface just need a menu component and can retrieve the rest. For example: By passing a TMenuItem instead of a TBaseMenuItem, the gtk interface does still not have all the information it needs. But it can retrieve the rest. So, replacing this parameter type, will only save a few lines of code in the win32 intf.

It wasn't about these parameters in particular. See: we already compromised on this function by 'exposing' the lcl object to it. If we follow correct OO-design, we should only pass an HMENU and an index or something like that.

Show quoted text 15 lines
>2) All these calls should be reported back. So CheckMenuItem not only >checks the menuitem in the interface, but it should also report back to >the lcl that it has checked the menuitem. .. and the LCL will check and react and call the interface again. This will distribute some platform independent logic over the LCL and the interfaces. The interfaces should be what they are named: just interfaces between the LCL and the widget set. If we say, that the interface is on the same lvl as the LCL, it implies *all* interface functions are on the same lvl. According to your example of the checking of a menu item: calling the interface function FillRect on a shared bitmap handle should unshare the bitmap. Just as the LCL does when you use the LCL FillRect.

Yes. This is bad.

Show quoted text 7 lines
>These two reasons combined, mainly reason 1 though, I'd still vote for >the 'hideous' way, putting the interfacebase above the LCL in the >hierarchy. The LCL uses the interface base. It can be above or on the same lvl, but never below.

The LCL doesn't use the interface in it's specification. Seeing the LCL as a black box, the interface never appears in any diagram. To me this indicates that the interface is on a higher level. The specification of the interface, however, does require the lcl.

Show quoted text 6 lines
>This could also have the advantage that potential users >aren't going to call the interface directly because it suddenly is a >'higher' level. What do you mean ?

Never mind I think; the argument doesn't work because users will look at the source code of the lcl and see the interface being used there.

Show quoted text 9 lines
>>- the interface functions can also be used by the user. Even if we say: >>Plz don't do. People will do. > >Yes, this is unavoidable indeed. But how does it relate to unnecessary >casting? 1. The LCL and its interfaces are full of examples of typecasting TControls to descendents.

This is mainly due to use of generic messages which can be valid for any type of control, hence TControl.

2. Users are humans, humans make mistakes, users will typecast without check and call the interface functions. => The interface should check the type.

Partly agree, however: people who blindly typecast A to B without thinking don't deserve help.

Show quoted text 7 lines
>>- We can add function to TBaseMenuItem, so that te typecast is not >>needed. > >Can you suggest an example? For example GetIndex and GetParent.

Now I understand. But this is ugly because you are looking at the code of the interface and deciding and that basis what functions to be in TBaseMenuItem which is a bad reason imho.

Micha.

Reply by email

Marc Weustink
to Harald Rinker: today i make a cvs update but after make i get the following errors:…
Mattias Gaertner wrote
On Thu, 27 Nov 2003 23:10:24 +0100 Marc Weustink wrote:

[snip]

Show quoted text 19 lines
> I don't think this is the way to go. Now, if the interface gets extended > with mode direct calls, we can add a TBase... for every > TComponent/TControl etc we need. > > OK, what happened. > > The LCL needs the baseinterface.. > The baseinterface needs the LCL.. > > That means problems. Sure you can introduce all kinds of base classes, but > > how would you do this with a TBaseControl and a TBaseWinControl ? > If we are going to introduce dedicated interface classes, it starts to > look like a discussion we had a few years ago. > > Seen the latest problems and implications, I wonder if we should continue > the last changes we made. IMO, we should undo it and try another route. What about replacing TBaseMenuItem with TComponent?

Hmm...

That would require a lot of typecasting, but is better. The new situation would be

The LCL needs the baseInterface and FCL
The baseInterface needs FCL
The XXXInterface needs LCL and baseInterface and FCL

I don't see a problem here.

Marc

Show quoted text 6 lines
Mattias _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives

Reply by email

Micha Nelissen
to Harald Rinker: today i make a cvs update but after make i get the following errors:…
Marc Weustink wrote 42 lines
At 23:24 27-11-2003, Mattias Gaertner wrote: > On Thu, 27 Nov 2003 23:10:24 +0100 Marc Weustink > wrote: [snip] > > I don't think this is the way to go. Now, if the interface gets > extended > > with mode direct calls, we can add a TBase... for every > > TComponent/TControl etc we need. > > > > OK, what happened. > > > > The LCL needs the baseinterface.. > > The baseinterface needs the LCL.. > > > > That means problems. Sure you can introduce all kinds of base > classes, but > > > > how would you do this with a TBaseControl and a TBaseWinControl ? > > If we are going to introduce dedicated interface classes, it starts to > > look like a discussion we had a few years ago. > > > > Seen the latest problems and implications, I wonder if we should > continue > > the last changes we made. IMO, we should undo it and try another route. > > What about replacing TBaseMenuItem with TComponent? Hmm... That would require a lot of typecasting, but is better. The new situation would be The LCL needs the baseInterface and FCL The baseInterface needs FCL The XXXInterface needs LCL and baseInterface and FCL I don't see a problem here.

I think the problem is that we are acting as if the LCL and the interface are seperate entities. As if they are independent. We say: the LCL uses the interface as if the interface is a layer completely below the LCL. But it is not. Mattias already said this of course, but it took a while for me to see the 'whole picture'. Correct ways to fix it:
1) Make the interface really indepedent. This means you should be able to rewrite all the programs in examples/ without using the lcl at all, only interfacebase.
2) Regard the lcl and interface as one layer. Then placing the interface on top of the lcl will justify not being able to write those examples without the lcl, because the interface depends on it, which it does.

Mattias: "So, I think, eventually we need to get rid of the generics." I agree, and I have some ideas but I am unsure how to do it exactly.

Micha.

Reply by email

Mattias Gaertner
to Harald Rinker: today i make a cvs update but after make i get the following errors:…
Show quoted text 73 lines
Mattias Gaertner wrote: > On Thu, 27 Nov 2003 19:22:37 +0100 Micha Nelissen > wrote: > > >>Mattias Gaertner wrote: >> >> >>>By using the the uses section in the implementation section you created >>>some circles. This is allowed, but it makes the code harder to >structure>>and less readable. They are allowed, but IMO you should try to >avoid>>them. >> >>I find the current approach less readable: extra units (menutype in this > >>case), extra definitions (TBaseMenuItem), unnecessary casting from >>TBaseMenuItem to TMenuItem, while we know it is a TMenuItem. > > > see below > > > >>IMHO, the >>interface hierarchy is like this: >> >>high - lcl (delphi compatible) interface >> - generic platform independant interface >> - lcl itself: controls, stdctrls, etc. >>low - lcl type definitions > > > I think we are talking about the same thing. Maybe a little bit more > clear: > > interface > .. uses .. > LCL > .. uses .. > interface base > .. uses .. > base types > > IMPORTANT: > In the following context, the "LCL" is the lazarus component library. > That means the OO components and not the interface functions. > >>From the user point of view this is the top level part, while the >interface > functions are the add ons, that are only used, if there is no LCL > component to handle the task. In other words: The LCL wraps the > interface in an object pascal way. > > For example: The user should never use the LCLCheckMenuItem. For the > user this is a low lvl function. The LCL delegates and controls the > interface. So, the interface base is below the LCL. > > Our trick is, that the actual implementations of the interface (gtk, > win32) overrides the interface base. And because the user does not use > the real interface, we have the choice to put it wherever we want in the > hierachy. And the easiest position for the implementation is above the > whole LCL and its base. That's why we can use TMenuItem in the win32 > intf. This is only because of its hideous character. If we would use a > perfect OO design, the implemented interface would ly right on the > interface base and would not know the LCL. You've made a good point here. However it has problems: 1) It assumes that all interfaces need the same information for doing the same thing, so we can pass exactly that information. This assumption is false as proven by recent CheckMenuItem. If, and I hope when, the qt interface is going to be implemented it may need other kinds of information currently not passed through the parameters.

I never assumed, that we pass all needed information as direct params. Only the needed information. The interface just need a menu component and can retrieve the rest. For example: By passing a TMenuItem instead of a TBaseMenuItem, the gtk interface does still not have all the information it needs. But it can retrieve the rest. So, replacing this parameter type, will only save a few lines of code in the win32 intf.

2) All these calls should be reported back. So CheckMenuItem not only checks the menuitem in the interface, but it should also report back to the lcl that it has checked the menuitem.

.. and the LCL will check and react and call the interface again.

This will distribute some platform independent logic over the LCL and the interfaces. The interfaces should be what they are named: just interfaces between the LCL and the widget set.
If we say, that the interface is on the same lvl as the LCL, it implies *all* interface functions are on the same lvl. According to your example of the checking of a menu item: calling the interface function FillRect on a shared bitmap handle should unshare the bitmap. Just as the LCL does when you use the LCL FillRect.

These two reasons combined, mainly reason 1 though, I'd still vote for the 'hideous' way, putting the interfacebase above the LCL in the hierarchy.

The LCL uses the interface base. It can be above or on the same lvl, but never below.

This could also have the advantage that potential users aren't going to call the interface directly because it suddenly is a 'higher' level.

What do you mean ?

Show quoted text 43 lines
Everything the interfacebase can do, the lcl should be able to do. So by using the lcl, users have its full potential and power available. > The other side: > What would happen, if we put the LCL and the interface base on the same > level? > This would mean, a call of LCLCheckMenuItem and the use of > AMenuItem.Checked:=true is equivalent. This would mean the LCL logic > must be handled in the interface (unchecking if it is a radio item, > etc.). I strongly suggest, that we do not try this way. This seems like my reason 2) above. In essence, what you are then trying to do, as we are partly doing now, is make H... out of everything which only the interface knows about: HDC, HWND, ... and then are synced to their corresponding object in the lcl. It does have a clear advantage also: my reason 1) is also solved, because that H... carries the information the interface needs to know about. Disadavantage is that you have all, or a lot of it, information twice. >>If we adhere to this order, nothing can go wrong. Things on lower level >>may use things on a higher level, but only when they need to implement >>functionality. >> >> >>>If units are ordered hierachical, an user can start exploring the high >>>lvl units and then go down, as he needs. But with unit circles, he >needs>>to read the whole circle to understand what is going on. >> >>I think not many users read interface uses and 'know' what's meant when >>he reads an interface call. > > > That's exactly my point. Although it seems, you can draw different > conclusions from it. > > > Back to the "unnecssary" casting: > - it is always a good idea to check the input of a function This is true, but doesn't apply in this case if you ask me. Pascal has quite strong typing. So let's use that to our advantage to provide as much information as possible.

An 'as' is even stronger and the compiler already checks for TBaseMenuItem.

Show quoted text 5 lines
> - the interface functions can also be used by the user. Even if we say: > Plz don't do. People will do. Yes, this is unavoidable indeed. But how does it relate to unnecessary casting?

1. The LCL and its interfaces are full of examples of typecasting TControls to descendents.
2. Users are humans, humans make mistakes, users will typecast without check and call the interface functions. => The interface should check the type.

> - We can add function to TBaseMenuItem, so that te typecast is not > needed. Can you suggest an example?

For example GetIndex and GetParent.

Mattias

Reply by email

Micha Nelissen
to Harald Rinker: today i make a cvs update but after make i get the following errors:…
Mattias Gaertner wrote 21 lines
On Thu, 27 Nov 2003 12:01:17 +0100 Micha Nelissen wrote: >Mattias Gaertner wrote: > > >>I broke several unnecessary unit circles. Can someone of the win32 >>people check, if the win32 intf compiles? My cross-compile is currently >>broken. > >Could you elaborate please? Did I introduce cycles causing errors in >compilation? I believe I made it such that the interface compiled when I >committed my stuff. Don't worry. It compiled. By using the the uses section in the implementation section you created some circles. This is allowed, but it makes the code harder to structure and less readable. They are allowed, but IMO you should try to avoid them.

I find the current approach less readable: extra units (menutype in this case), extra definitions (TBaseMenuItem), unnecessary casting from TBaseMenuItem to TMenuItem, while we know it is a TMenuItem. IMHO, the interface hierarchy is like this:

high - lcl (delphi compatible) interface
- generic platform independant interface
- lcl itself: controls, stdctrls, etc.
low - lcl type definitions

If we adhere to this order, nothing can go wrong. Things on lower level may use things on a higher level, but only when they need to implement functionality.

If units are ordered hierachical, an user can start exploring the high lvl units and then go down, as he needs. But with unit circles, he needs to read the whole circle to understand what is going on.

I think not many users read interface uses and 'know' what's meant when he reads an interface call.

Just my 2 eurocents,

Micha.

Reply by email

Mattias Gaertner
to Harald Rinker: today i make a cvs update but after make i get the following errors:…
Show quoted text 26 lines
Mattias Gaertner wrote: > On Thu, 27 Nov 2003 21:38:25 +0100 Micha Nelissen > wrote: > > >>You've made a good point here. However it has problems: >>1) It assumes that all interfaces need the same information for doing >>the same thing, so we can pass exactly that information. This assumption > >>is false as proven by recent CheckMenuItem. If, and I hope when, the qt >>interface is going to be implemented it may need other kinds of >>information currently not passed through the parameters. > > > I never assumed, that we pass all needed information as direct params. > Only the needed information. The interface just need a menu component > and can retrieve the rest. For example: By passing a TMenuItem instead > of a TBaseMenuItem, the gtk interface does still not have all the > information it needs. But it can retrieve the rest. So, replacing this > parameter type, will only save a few lines of code in the win32 intf. It wasn't about these parameters in particular. See: we already compromised on this function by 'exposing' the lcl object to it. If we follow correct OO-design, we should only pass an HMENU and an index or something like that.

Or a TBaseMenuItem, which is a base type.

Show quoted text 28 lines
>>2) All these calls should be reported back. So CheckMenuItem not only >>checks the menuitem in the interface, but it should also report back to >>the lcl that it has checked the menuitem. > > > .. and the LCL will check and react and call the interface again. > > This will distribute some platform independent logic over the LCL and > the interfaces. The interfaces should be what they are named: just > interfaces between the LCL and the widget set. > If we say, that the interface is on the same lvl as the LCL, it implies > *all* interface functions are on the same lvl. According to your example > of the checking of a menu item: calling the interface function FillRect > on a shared bitmap handle should unshare the bitmap. Just as the LCL > does when you use the LCL FillRect. Yes. This is bad. >>These two reasons combined, mainly reason 1 though, I'd still vote for >>the 'hideous' way, putting the interfacebase above the LCL in the >>hierarchy. > > > The LCL uses the interface base. It can be above or on the same lvl, but > never below. The LCL doesn't use the interface in it's specification. Seeing the LCL as a black box, the interface never appears in any diagram.

Because the users should not use the interfaces, they should use the LCL. And the LCL uses the interfaces. This way we can put all the platform dependent code into the interfaces and all the platform independent code into the LCL (including the logic, which is always platform independent and always on top).
So, the interface part of the LCL is hidden behind the LCL controls.

To me this indicates that the interface is on a higher level. The specification of the interface, however, does require the lcl.

It depends, how you define "LCL".
The interface part does not need to know a TCheckListBox to implement a check list box thing. The win32api like functions are enough. (Theoretically spoken).

Show quoted text 22 lines
>>This could also have the advantage that potential users >>aren't going to call the interface directly because it suddenly is a >>'higher' level. > > > What do you mean ? Never mind I think; the argument doesn't work because users will look at the source code of the lcl and see the interface being used there. >>>- the interface functions can also be used by the user. Even if we say: >>>Plz don't do. People will do. >> >>Yes, this is unavoidable indeed. But how does it relate to unnecessary >>casting? > > > 1. The LCL and its interfaces are full of examples of typecasting > TControls to descendents. This is mainly due to use of generic messages which can be valid for any type of control, hence TControl.

Yes, and btw, this destroys smart linking. So, I think, eventually we need to get rid of the generics.

Show quoted text 6 lines
> 2. Users are humans, humans make mistakes, users will typecast without > check and call the interface functions. => The interface should check > the type. Partly agree, however: people who blindly typecast A to B without thinking don't deserve help.

:)
A good lib recognize misuse and warns to spot errors early.

Show quoted text 11 lines
>>>- We can add function to TBaseMenuItem, so that te typecast is not >>>needed. >> >>Can you suggest an example? > > > For example GetIndex and GetParent. Now I understand. But this is ugly because you are looking at the code of the interface and deciding and that basis what functions to be in TBaseMenuItem which is a bad reason imho.

Huh? The TBaseMenuItem is part of the interface base, so its only purpose is to make the communication with the interfaces more easier.

Mattias

Reply by email

Marc Weustink
to Harald Rinker: today i make a cvs update but after make i get the following errors:…
Mattias Gaertner wrote 43 lines
On Thu, 27 Nov 2003 23:40:38 +0100 Marc Weustink wrote: > At 23:24 27-11-2003, Mattias Gaertner wrote: > >On Thu, 27 Nov 2003 23:10:24 +0100 Marc Weustink > >wrote: > > [snip] > > > > I don't think this is the way to go. Now, if the interface gets > > > extended with mode direct calls, we can add a TBase... for every > > > TComponent/TControl etc we need. > > > > > > OK, what happened. > > > > > > The LCL needs the baseinterface.. > > > The baseinterface needs the LCL.. > > > > > > That means problems. Sure you can introduce all kinds of base classes, > > > but > > > > > > how would you do this with a TBaseControl and a TBaseWinControl ? > > > If we are going to introduce dedicated interface classes, it starts to > > > look like a discussion we had a few years ago. > > > > > > Seen the latest problems and implications, I wonder if we should > > > continue the last changes we made. IMO, we should undo it and try > > > another route. > > > >What about replacing TBaseMenuItem with TComponent? > > Hmm... > > That would require a lot of typecasting, but is better. > The new situation would be > > The LCL needs the baseInterface and FCL > The baseInterface needs FCL > The XXXInterface needs LCL and baseInterface and FCL > > I don't see a problem here. No wonder. It is the old situation. :)

Nah, not complete. In the old situation an internal interface object (handle) was passed.

I will change it ...

OK.

Marc

Reply by email

Mattias Gaertner
to Harald Rinker: today i make a cvs update but after make i get the following errors:…
Show quoted text 126 lines
At 22:41 27-11-2003, Micha Nelissen wrote: >Mattias Gaertner wrote: > >>On Thu, 27 Nov 2003 21:38:25 +0100 Micha Nelissen >> wrote: >> >>>You've made a good point here. However it has problems: >>>1) It assumes that all interfaces need the same information for doing >>>the same thing, so we can pass exactly that information. This >assumption >>is false as proven by recent CheckMenuItem. If, and I hope >when, the qt >>interface is going to be implemented it may need other >kinds of >>information currently not passed through the parameters. >> >>I never assumed, that we pass all needed information as direct params. >>Only the needed information. The interface just need a menu component >and >can retrieve the rest. For example: By passing a TMenuItem instead >of a >TBaseMenuItem, the gtk interface does still not have all the >information >it needs. But it can retrieve the rest. So, replacing this >parameter >type, will only save a few lines of code in the win32 intf. > >It wasn't about these parameters in particular. See: we already >compromised on this function by 'exposing' the lcl object to it. If we >follow correct OO-design, we should only pass an HMENU and an index or >something like that. I dont see what correct OO has to do with that. >>>2) All these calls should be reported back. So CheckMenuItem not only >>>checks the menuitem in the interface, but it should also report back to > >>>the lcl that it has checked the menuitem. I do not agree with that. That is one of the reasons why I removed the bChecked/bEnabled boolean. It is just a call to the interface to update the interface, not more. The LCL logic is in the LCL only. >>.. and the LCL will check and react and call the interface again. >>This will distribute some platform independent logic over the LCL and >the >interfaces. Indeed >>The interfaces should be what they are named: just interfaces >>between the LCL and the widget set. If we say, that the interface is on >>the same lvl as the LCL, it implies *all* interface functions are on the > >>same lvl. According to your example of the checking of a menu item: >>calling the interface function FillRect on a shared bitmap handle should > >>unshare the bitmap. Just as the LCL does when you use the LCL FillRect. > >Yes. This is bad. > >>>These two reasons combined, mainly reason 1 though, I'd still vote for >>>the 'hideous' way, putting the interfacebase above the LCL in the >hierarchy.> >>The LCL uses the interface base. It can be above or on the same lvl, but > >>never below. > >The LCL doesn't use the interface in it's specification. Seeing the LCL >as a black box, the interface never appears in any diagram. To me this >indicates that the interface is on a higher level. The specification of >the interface, however, does require the lcl. > >>>This could also have the advantage that potential users aren't going to > >>>call the interface directly because it suddenly is a 'higher' level. >> >>What do you mean ? > >Never mind I think; the argument doesn't work because users will look at >the source code of the lcl and see the interface being used there. > >>>>- the interface functions can also be used by the user. Even if we >say:>>>Plz don't do. People will do. >>> >>>Yes, this is unavoidable indeed. But how does it relate to unnecessary >>>casting? >> >>1. The LCL and its interfaces are full of examples of typecasting >>TControls to descendents. > >This is mainly due to use of generic messages which can be valid for any >type of control, hence TControl. > >>2. Users are humans, humans make mistakes, users will typecast without >>check and call the interface functions. => The interface should check >the type. > >Partly agree, however: people who blindly typecast A to B without >thinking don't deserve help. > >>>>- We can add function to TBaseMenuItem, so that te typecast is not >>>>needed. >>> >>>Can you suggest an example? >> >>For example GetIndex and GetParent. > >Now I understand. But this is ugly because you are looking at the code of > >the interface and deciding and that basis what functions to be in >TBaseMenuItem which is a bad reason imho. OK, now I got curious about the new changes, so I got the latest cvs.... YUCK ! I don't think this is the way to go. Now, if the interface gets extended with mode direct calls, we can add a TBase... for every TComponent/TControl etc we need. OK, what happened. The LCL needs the baseinterface.. The baseinterface needs the LCL.. That means problems. Sure you can introduce all kinds of base classes, but how would you do this with a TBaseControl and a TBaseWinControl ? If we are going to introduce dedicated interface classes, it starts to look like a discussion we had a few years ago. Seen the latest problems and implications, I wonder if we should continue the last changes we made. IMO, we should undo it and try another route.

What about replacing TBaseMenuItem with TComponent?

Mattias

Reply by email

Mattias Gaertner
to Harald Rinker: today i make a cvs update but after make i get the following errors:…
Show quoted text 9 lines
Mattias Gaertner wrote: > I broke several unnecessary unit circles. Can someone of the win32 > people check, if the win32 intf compiles? My cross-compile is currently > broken. Could you elaborate please? Did I introduce cycles causing errors in compilation? I believe I made it such that the interface compiled when I committed my stuff.

Don't worry. It compiled.

By using the the uses section in the implementation section you created some circles. This is allowed, but it makes the code harder to structure and less readable. They are allowed, but IMO you should try to avoid them. If units are ordered hierachical, an user can start exploring the high lvl units and then go down, as he needs. But with unit circles, he needs to read the whole circle to understand what is going on.

Mattias

Reply by email

Micha Nelissen
to Harald Rinker: today i make a cvs update but after make i get the following errors:…
Mattias Gaertner wrote 61 lines
On Thu, 27 Nov 2003 19:22:37 +0100 Micha Nelissen wrote: >Mattias Gaertner wrote: > > >>By using the the uses section in the implementation section you created >>some circles. This is allowed, but it makes the code harder to structure >>and less readable. They are allowed, but IMO you should try to avoid >>them. > >I find the current approach less readable: extra units (menutype in this >case), extra definitions (TBaseMenuItem), unnecessary casting from >TBaseMenuItem to TMenuItem, while we know it is a TMenuItem. see below >IMHO, the >interface hierarchy is like this: > >high - lcl (delphi compatible) interface > - generic platform independant interface > - lcl itself: controls, stdctrls, etc. >low - lcl type definitions I think we are talking about the same thing. Maybe a little bit more clear: interface .. uses .. LCL .. uses .. interface base .. uses .. base types IMPORTANT: In the following context, the "LCL" is the lazarus component library. That means the OO components and not the interface functions. >From the user point of view this is the top level part, while the interface functions are the add ons, that are only used, if there is no LCL component to handle the task. In other words: The LCL wraps the interface in an object pascal way. For example: The user should never use the LCLCheckMenuItem. For the user this is a low lvl function. The LCL delegates and controls the interface. So, the interface base is below the LCL. Our trick is, that the actual implementations of the interface (gtk, win32) overrides the interface base. And because the user does not use the real interface, we have the choice to put it wherever we want in the hierachy. And the easiest position for the implementation is above the whole LCL and its base. That's why we can use TMenuItem in the win32 intf. This is only because of its hideous character. If we would use a perfect OO design, the implemented interface would ly right on the interface base and would not know the LCL.

You've made a good point here. However it has problems:
1) It assumes that all interfaces need the same information for doing the same thing, so we can pass exactly that information. This assumption is false as proven by recent CheckMenuItem. If, and I hope when, the qt interface is going to be implemented it may need other kinds of information currently not passed through the parameters.
2) All these calls should be reported back. So CheckMenuItem not only checks the menuitem in the interface, but it should also report back to the lcl that it has checked the menuitem.

These two reasons combined, mainly reason 1 though, I'd still vote for the 'hideous' way, putting the interfacebase above the LCL in the hierarchy. This could also have the advantage that potential users aren't going to call the interface directly because it suddenly is a 'higher' level. Everything the interfacebase can do, the lcl should be able to do. So by using the lcl, users have its full potential and power available.

Show quoted text 7 lines
The other side: What would happen, if we put the LCL and the interface base on the same level? This would mean, a call of LCLCheckMenuItem and the use of AMenuItem.Checked:=true is equivalent. This would mean the LCL logic must be handled in the interface (unchecking if it is a radio item, etc.). I strongly suggest, that we do not try this way.

This seems like my reason 2) above. In essence, what you are then trying to do, as we are partly doing now, is make H... out of everything which only the interface knows about: HDC, HWND, ... and then are synced to their corresponding object in the lcl. It does have a clear advantage also: my reason 1) is also solved, because that H... carries the information the interface needs to know about. Disadavantage is that you have all, or a lot of it, information twice.

Show quoted text 19 lines
>If we adhere to this order, nothing can go wrong. Things on lower level >may use things on a higher level, but only when they need to implement >functionality. > > >>If units are ordered hierachical, an user can start exploring the high >>lvl units and then go down, as he needs. But with unit circles, he needs >>to read the whole circle to understand what is going on. > >I think not many users read interface uses and 'know' what's meant when >he reads an interface call. That's exactly my point. Although it seems, you can draw different conclusions from it. Back to the "unnecssary" casting: - it is always a good idea to check the input of a function

This is true, but doesn't apply in this case if you ask me. Pascal has quite strong typing. So let's use that to our advantage to provide as much information as possible.

- the interface functions can also be used by the user. Even if we say: Plz don't do. People will do.

Yes, this is unavoidable indeed. But how does it relate to unnecessary casting?

- We can add function to TBaseMenuItem, so that te typecast is not needed.

Can you suggest an example?

Thanks for your reply,

Micha.

Reply by email

Marc Weustink
to Harald Rinker: today i make a cvs update but after make i get the following errors:…
Micha Nelissen wrote 23 lines
Mattias Gaertner wrote: >On Thu, 27 Nov 2003 21:38:25 +0100 Micha Nelissen > wrote: > >>You've made a good point here. However it has problems: >>1) It assumes that all interfaces need the same information for doing >>the same thing, so we can pass exactly that information. This assumption >>is false as proven by recent CheckMenuItem. If, and I hope when, the qt >>interface is going to be implemented it may need other kinds of >>information currently not passed through the parameters. > >I never assumed, that we pass all needed information as direct params. >Only the needed information. The interface just need a menu component and >can retrieve the rest. For example: By passing a TMenuItem instead of a >TBaseMenuItem, the gtk interface does still not have all the information >it needs. But it can retrieve the rest. So, replacing this parameter >type, will only save a few lines of code in the win32 intf. It wasn't about these parameters in particular. See: we already compromised on this function by 'exposing' the lcl object to it. If we follow correct OO-design, we should only pass an HMENU and an index or something like that.

I dont see what correct OO has to do with that.

>>2) All these calls should be reported back. So CheckMenuItem not only >>checks the menuitem in the interface, but it should also report back to >>the lcl that it has checked the menuitem.

I do not agree with that. That is one of the reasons why I removed the bChecked/bEnabled boolean. It is just a call to the interface to update the interface, not more. The LCL logic is in the LCL only.

>.. and the LCL will check and react and call the interface again. >This will distribute some platform independent logic over the LCL and the >interfaces.

Indeed

Show quoted text 56 lines
>The interfaces should be what they are named: just interfaces >between the LCL and the widget set. If we say, that the interface is on >the same lvl as the LCL, it implies *all* interface functions are on the >same lvl. According to your example of the checking of a menu item: >calling the interface function FillRect on a shared bitmap handle should >unshare the bitmap. Just as the LCL does when you use the LCL FillRect. Yes. This is bad. >>These two reasons combined, mainly reason 1 though, I'd still vote for >>the 'hideous' way, putting the interfacebase above the LCL in the hierarchy. > >The LCL uses the interface base. It can be above or on the same lvl, but >never below. The LCL doesn't use the interface in it's specification. Seeing the LCL as a black box, the interface never appears in any diagram. To me this indicates that the interface is on a higher level. The specification of the interface, however, does require the lcl. >>This could also have the advantage that potential users aren't going to >>call the interface directly because it suddenly is a 'higher' level. > >What do you mean ? Never mind I think; the argument doesn't work because users will look at the source code of the lcl and see the interface being used there. >>>- the interface functions can also be used by the user. Even if we say: >>>Plz don't do. People will do. >> >>Yes, this is unavoidable indeed. But how does it relate to unnecessary >>casting? > >1. The LCL and its interfaces are full of examples of typecasting >TControls to descendents. This is mainly due to use of generic messages which can be valid for any type of control, hence TControl. >2. Users are humans, humans make mistakes, users will typecast without >check and call the interface functions. => The interface should check the type. Partly agree, however: people who blindly typecast A to B without thinking don't deserve help. >>>- We can add function to TBaseMenuItem, so that te typecast is not >>>needed. >> >>Can you suggest an example? > >For example GetIndex and GetParent. Now I understand. But this is ugly because you are looking at the code of the interface and deciding and that basis what functions to be in TBaseMenuItem which is a bad reason imho.

OK, now I got curious about the new changes, so I got the latest cvs....

YUCK !

I don't think this is the way to go. Now, if the interface gets extended with mode direct calls, we can add a TBase... for every TComponent/TControl etc we need.

OK, what happened.

The LCL needs the baseinterface..
The baseinterface needs the LCL..

That means problems. Sure you can introduce all kinds of base classes, but how would you do this with a TBaseControl and a TBaseWinControl ? If we are going to introduce dedicated interface classes, it starts to look like a discussion we had a few years ago.

Seen the latest problems and implications, I wonder if we should continue the last changes we made. IMO, we should undo it and try another route.

Marc

Reply by email

Mattias Gaertner
to Harald Rinker: today i make a cvs update but after make i get the following errors:…
Show quoted text 38 lines
At 23:24 27-11-2003, Mattias Gaertner wrote: >On Thu, 27 Nov 2003 23:10:24 +0100 Marc Weustink >wrote: [snip] > > I don't think this is the way to go. Now, if the interface gets > > extended with mode direct calls, we can add a TBase... for every > > TComponent/TControl etc we need. > > > > OK, what happened. > > > > The LCL needs the baseinterface.. > > The baseinterface needs the LCL.. > > > > That means problems. Sure you can introduce all kinds of base classes, > > but > > > > how would you do this with a TBaseControl and a TBaseWinControl ? > > If we are going to introduce dedicated interface classes, it starts to > > look like a discussion we had a few years ago. > > > > Seen the latest problems and implications, I wonder if we should > > continue the last changes we made. IMO, we should undo it and try > > another route. > >What about replacing TBaseMenuItem with TComponent? Hmm... That would require a lot of typecasting, but is better. The new situation would be The LCL needs the baseInterface and FCL The baseInterface needs FCL The XXXInterface needs LCL and baseInterface and FCL I don't see a problem here.

No wonder. It is the old situation. :)
I will change it ...

Mattias

Reply by email

Micha Nelissen
to Harald Rinker: today i make a cvs update but after make i get the following errors:…
Mattias Gaertner wrote 10 lines
On Fri, 28 Nov 2003 08:53:32 +0100 Micha Nelissen wrote: >Mattias: "So, I think, eventually we need to get rid of the generics." >I agree, and I have some ideas but I am unsure how to do it exactly. Then we are two. I know, how to fix the smart linking (getting rid of the case statements and such things), but I fear the consequences.

Would you care to elaborate?

Micha.

Reply by email

Mattias Gaertner
to Harald Rinker: today i make a cvs update but after make i get the following errors:…
Show quoted text 12 lines
Maybe this can enlighten this discussion: - There are 4 players: LCL base, interface base, LCL and the various interfaces - Goals: + LCL base, interface base and LCL are platform independent + Interfaces are platform dependent + compile once the platform independent part, then compile every platform dependent part separately (e.g. under linux: compile LCL once, then gtk, gnome, gtk intf) => interfaces depend on interfacebase => this point does not imply any relationship between LCL and an interface

, except that the LCL can not depend on the interfaces.

Show quoted text 20 lines
+ LCL uses the interface base to talk to the real interface => interface base on same or below lvl than LCL => still no implication for the interfaces + LCL contains the logic, interface base not => LCL and interface base are not on same lvl + the LCL base are just some very basic functions and types, which can also be moved to the FCL, but are not. They are below all. Ergo: - LCL is above interface base is above LCL base - Still no implication for the relationship of the LCL and the interfaces. Not even the implication that we have to separate them. So, the gtk intf was implemented depending on the LCL to make programming easier. This was just a decision for the gtk intf. Other interfaces don't need to depend on the LCL. For example: Someone can write a MyCL using the interfacebase and write an interface for say wxWindows. But: No one wants to use the interface base without the LCL. The interface base is not very comfortable.

Mattias

Reply by email

Mattias Gaertner
to Harald Rinker: today i make a cvs update but after make i get the following errors:…
Show quoted text 14 lines
Mattias Gaertner wrote: > On Fri, 28 Nov 2003 08:53:32 +0100 Micha Nelissen > wrote: > > >>Mattias: "So, I think, eventually we need to get rid of the generics." >>I agree, and I have some ideas but I am unsure how to do it exactly. > > > Then we are two. I know, how to fix the smart linking (getting rid of > the case statements and such things), but I fear the consequences. Would you care to elaborate?

I really hoped, you would forget my note.
Probably you know, what smart linking means and how smart linking optimization is done in object pascal. In case of the LCL and especially its interfaces this will lead to very in depth discussions of a lot of functions. I think, such things should go to the devel list. I know from experience that the needed changes will be discussed furiously. Marc will not be amused and I'm no friend of such code as well.

Mattias

Reply by email

Mattias Gaertner
to Harald Rinker: today i make a cvs update but after make i get the following errors:…
Show quoted text 53 lines
Marc Weustink wrote: > At 23:24 27-11-2003, Mattias Gaertner wrote: > >> On Thu, 27 Nov 2003 23:10:24 +0100 Marc Weustink >> wrote: > > > [snip] > >> > I don't think this is the way to go. Now, if the interface gets >> extended >> > with mode direct calls, we can add a TBase... for every >> > TComponent/TControl etc we need. >> > >> > OK, what happened. >> > >> > The LCL needs the baseinterface.. >> > The baseinterface needs the LCL.. >> > >> > That means problems. Sure you can introduce all kinds of base >> classes, but >> > >> > how would you do this with a TBaseControl and a TBaseWinControl ? >> > If we are going to introduce dedicated interface classes, it starts >to> > look like a discussion we had a few years ago. >> > >> > Seen the latest problems and implications, I wonder if we should >> continue >> > the last changes we made. IMO, we should undo it and try another >route.> >> What about replacing TBaseMenuItem with TComponent? > > > Hmm... > > That would require a lot of typecasting, but is better. > The new situation would be > > The LCL needs the baseInterface and FCL > The baseInterface needs FCL > The XXXInterface needs LCL and baseInterface and FCL > > I don't see a problem here. I think the problem is that we are acting as if the LCL and the interface are seperate entities. As if they are independent. We say: the LCL uses the interface as if the interface is a layer completely below the LCL. But it is not. Mattias already said this of course, but it took a while for me to see the 'whole picture'. Correct ways to fix it: 1) Make the interface really indepedent. This means you should be able to rewrite all the programs in examples/ without using the lcl at all, only interfacebase.

Speaking of interfacebase: Yes, you can do that.
But who wants to?

2) Regard the lcl and interface as one layer. Then placing the interface on top of the lcl will justify not being able to write those examples without the lcl, because the interface depends on it, which it does.

Maybe this can enlighten this discussion:
- There are 4 players: LCL base, interface base, LCL and the various interfaces
- Goals:
+ LCL base, interface base and LCL are platform independent
+ Interfaces are platform dependent
+ compile once the platform independent part,
then compile every platform dependent part separately (e.g. under linux: compile LCL once, then gtk, gnome, gtk intf) => interfaces depend on interfacebase
=> this point does not imply any relationship between LCL and an interface
+ LCL uses the interface base to talk to the real interface => interface base on same or below lvl than LCL
=> still no implication for the interfaces
+ LCL contains the logic, interface base not
=> LCL and interface base are not on same lvl
+ the LCL base are just some very basic functions
and types, which can also be moved to the FCL,
but are not. They are below all.

Ergo:
- LCL is above interface base is above LCL base
- Still no implication for the relationship of the LCL and the interfaces. Not even the implication that we have to separate them. So, the gtk intf was implemented depending on the LCL to make programming easier. This was just a decision for the gtk intf. Other interfaces don't need to depend on the LCL. For example: Someone can write a MyCL using the interfacebase and write an interface for say wxWindows.
But: No one wants to use the interface base without the LCL. The interface base is not very comfortable.

Mattias: "So, I think, eventually we need to get rid of the generics." I agree, and I have some ideas but I am unsure how to do it exactly.

Then we are two. I know, how to fix the smart linking (getting rid of the case statements and such things), but I fear the consequences.

Mattias

Reply by email