[Lazarus] Circular references

Michael Van Canneyt michael at freepascal.org
Fri Aug 14 08:54:22 CEST 2009



On Fri, 14 Aug 2009, Graeme Geldenhuys wrote:

> Lance Collins wrote:
>> Sorry if this is the wrong place to discuss language issues.
>
> Probably the fpc-dev mailing list.
>
>> 
>>> How can you avoid circular references with two modules that interact with 
>>> each other?
> [...snip...]
>> 
>> This feature is often needed and the "if you need to do that then
>> something is wrong with your design" argument doesn't fly with me.
>
>
> I can't agree more. Sometimes there is a valid design for something like 
> that. The compilers already handle forward declarations in the same unit, so 
> why can that not be applied for multiple units as well. And if the forward 
> declaration is not fully resolved by the time the whole project or unit is 
> compiled - raise a compiler error.
>
> The current usage of forward declaration is exactly the same principle we are 
> trying to use, but this time just across units.

This is the world upside down. Better tell us exactly why you think this must 
be possible. the 'Sometimes there is a valid design for something like that' 
is not an argument at all. Maybe there are other - more valid - ways to
accomplish what you want.

Michael.




More information about the Lazarus mailing list