Note for allowing interface sections with multiple implementation sections we already have inc files.
The multi-platform support is even built on that.
Personally
- I can live with how it is now.
- I use include files when appropriate.
- If you have many circular references on the same platform your architecture is probably wrong and we can probably set you on a better track when we see some code..
Problem solved.
I am talking about one platform. And i don't think that my architecture is wrong. The problem is that you always have to refactor your class layout when
you need to have two classes which need to reference each other. And this is only needed to circumvent the "circular unit problem". In Free Pascal it is
possible to have two classes reference each other as long as the two classes are in the same unit. So you are right, i can use include files but in fact that
will lead to one big unit.
I do not really see the point why that, what works inside on unit, is not allowed across two units. This really blows up the class layout and forces you to
build in some hacks. What is wrong with classes referencing each other when they are in different units instead of the same one?
You can not just say it's bad design!
There might have been reasons in the past why it should not be possible to have two units uses each other in the interface section. But i do not think
that we still need it today.
When the compiler finds a unit it already has parsed it can break stepping into this unit's interface section and proecess with the next used unit and
everything which is needed for building types should be there. If the parser the finds a class which is not defined it can do an implicit forward declaration and see if it will be solved until the interface section.
And that should be enough.
If i would know the compiler sources i would have done a try already. But unfortunately i do not! So maybe someone of the FPC team could give this idea a try?