Juha Manninen wrote:
Hi
Circular references are a real problem in real (non-trivial) Object Pascal
programs. You could look at this thread:
http://www.mail-archive.com/[email protected]/msg16051.html
The solution is to copy everything into one big unit. That's what everybody
finally does after fighting with interfaces, abstract base classes and type
casting.
Agreed. I think I remember bringing this up on the Delphi NG's not too long
ago. Little things like that do not make it impossible, but still I think make
more work to implement OOP patterned software. You really have to give extra
thought to the "geography" of an application's code base to avoid painting
yourself into a corner. For some things, I just make it easier on myself and
try to stick as much of an object hierarchy into one unit as I can in good
(self) conscience get away with. State Pattern comes to mind where I use
objects to represent state. Either create all your objects at one time or stick
the class definitions in one unit otherwise the circular reference things pokes
its head out again.
I know there are interfaces (which I definitely use though not to extent that I
do in other languages like C# or ActionScript where I seem to get more mileage
with them) and the implementation uses area to reference safely other units, but
the end is the same. Namely that it feels in many instances like I'm using more
of workarounds to achieve some OO things when it should feel like I'm
implementing in a way that feels more natural as it seems to me to be with some
other languages.
Of course, the GC'd vs explicit memory management seems to the the cause of many
of these differences. I know the circular reference thing is related to the
compiler or linker, just one other little thing that I'd like to see resolved
some day in OP as I plan to stick with it for some time.
BTW, not a criticism. Just an observation probably in need of correcting in
many places :-)
--
Warm Regards,
Lee
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus