[lazarus] Circle dependencies in the lcl

Marc Weustink Marc.Weustink at cuperus.nl
Mon Jan 15 11:21:05 EST 2001


+ From: Mattias Gaertner [mailto:nc-gaertnma at netcologne.de]
+
+ Hi all,
+
+ I want to discuss a structure problem in the LCL.
+ This is nothing new:
+ There some circle dependencies in the LCL. For example
+ forms.pp<->controls.pp.
+ Although the compiler can handle this, there are some
+ problems. Some weeks ago this was hidden with funny tricks
+ like "make -C lcl" 6 times. Then a new trick was
+ invented: -Ca. AFAIK this prevents some optimization.

It isn't a trick. If you want to distribute only a binary LCL I think you
need it anyhow. (Think of this: If you don't need all functionality of the
LCL a more optimized LCL could exist so it needs to be recompiled for that
purpose)

+ I believe it is bad coding to program circle dependencies. A
+ circle is an important sign that code should be gathered in one unit.

I think you can't avoid it.  If look at the VCL itself, how many times are
objects referred within one unit ?? In a circular reference you do allmost
the same. Only now for redability/maintainability/etc you split one unit
into 2 separate units.

If I look at the project I'm working on myself, I tried to avoid it, but
unless I let my units grow (if you put all in one unit your problem is
solved), I couldn't

+ What do you think?

Believe me, when I tried to create the Makefiles, I tried to first compile
the Interface, after that the LCL (since the LCL is interface indipendent,
only a binary interface should satisfy). There were that many circular
references that I gave up.

Whithin the LCL it is a project on it's own to remove all dependencies.
Sure, we should avoud it if we can, but I don't think we can without.

Marc






More information about the Lazarus mailing list