[lazarus] compile error on New Sources from cvs - FIXED

Micha Nelissen M.Nelissen at student.tue.nl
Thu Nov 27 13:11:52 EST 2003


Mattias Gaertner wrote:

> On Thu, 27 Nov 2003 12:01:17 +0100  Micha Nelissen
> <M.Nelissen at student.tue.nl> 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.






More information about the Lazarus mailing list