<div>Hi</div><div><br></div><div>There is lots of duplicate code and data definitions between Lazarus TProject and TLazPackage (and their ancestors).</div><div>I tried to improve the situation by creating a common base class for them. It is not possible because it ends up with a circular reference hell.</div>
<div><br></div><div>Almost 2 years ago I suggested to solve the problem in language syntax somehow.</div><div> <a href="http://lists.freepascal.org/lists/fpc-devel/2010-January/018909.html">http://lists.freepascal.org/lists/fpc-devel/2010-January/018909.html</a></div>
<div><br></div><div>The comments always tell to use interfaces and abstract base classes, and claim that this feature enforces good design.</div><div>Bollocks!</div><div>This feature enforces BAD design and implementation. Lazarus itself is an example of it.</div>
<div>Is copy-pasting code between Project and Package a sign of good design. IMO it is not.</div><div>Is the class structure somehow flawed if such problems happen. No it is not. Such things happen in big, real projects.</div>
<div><br></div><div>For the same reason there are many type-casts in Lazarus core units. A variable is type-casted from base class to the real class.</div><div>Another common solution is to copy all code into one big file. It is not only a bad thing but it has some limits. You wouldn't want to copy most Lazarus code into one file for example.</div>
<div>Thus I found it strange that even Lazarus developers claimed they never encountered such problems. Yet, they have clearly worked hard to avoid circular references.</div><div>It is almost like in a religious sect, nobody dares to admit it was a mistake to join it.</div>
<div><br></div><div>I read the Bold application has abandoned Delphi native code and moved to .NET.</div><div>The reason was mostly circular reference problems, which I understand with such object framework tool.</div><div>
<br></div><div>I am not expecting any solution for this now. Even the latest Delphi has not solved it although it has many other syntax additions.</div><div>I just feel strongly that the language will remain a niche, not interesting for most people, because of this one single problem. Pretty much all other features are good.</div>
<div>Pity!</div><div>I remember already years ago someone told me he used Delphi but it was not suitable for big projects because of circular reference problems, and he moved to other languages.</div><div>Then I didn't understand how serious the problem is but I learned it later.</div>
<div><br></div><div>If someone still wants to claim that there is absolutely no problem, please show me how to reuse code between Lazarus Project and Package thus avoiding the duplicate code, without copying most Lazarus code into one unit.</div>
<div>Then I will believe there is no problem.</div><div>Or, explain me why it is a good thing to have all those type-casts in Lazarus core-units (connecting to Designer etc.).</div><div><br></div><div>Sorry for this rant. I like to solve problems but there is no way to solve this one, except for changing the language. Frustrated now...</div>
<div><br></div><div><br></div><div>Juha</div><div><br></div>