Thank you kupferstecher for your response.
I am very pleased to know that there are other developers interested in this topic.
if you use a seperate program to merge split units, you probably get trouble with code navigation and code completion in the IDE.
At the moment what you say is very likely; but I'm trying to increase feature integration with Lazarus-IDE.
What I could think about of being a useful feature is that a Class could be declared as 'friend' with an other class which would allow to access e.g. protected fields of that other class directly. With this feature two units could be linearly entangled (which imho is ok) and still the encapsulation to outside units would be kept, as only public declarations are accessible to third units. But this would mean additional complexitivity to the language, I'm not sure if it would be worth it.
Your proposal looks very interesting; from an initial evaluation I think can be integrated into the abstract concept of PartialUnit. After studying and thinking more, I will ask you for more details.
I'm not sure what is your final target
At this stage, the ultimate purpose of the project is still very difficult to describe, I have yet to prepare a clear and organic speech. Generally speaking, what I would like to achieve is facilitation in the introduction of new features into the Lazarus-IDE/FPC programming environment avoiding, where possible, compiler changes.
Implementing PartialUnits might e.g. help when converting code from other programming languages. It would be possible to deal separately with the different implementations of OOP (or other programming paradigms) that are unique to each programming language.
A hint of what I'm saying is present in the code I reported in my previous post.
In particular, we could use this method to replace the file "Lazarus Form" (.lfm file) with Pascal Object code. The various declarations and implementations of the code could be distributed in accordance with the preferred OOP logic: in fact,
the PartialUnits, in my opinion, are not to be considered separate Units, but a single unit deployed in different blocks of code. As you can see from the example, both have the same name as "
unitMain". I have not yet adapted the merging code (pasunitmerge) to be able to respect the distribution of the code to my liking e.g. the definition of the InitializeLayaut method would go all over in the file "PunitMain_LFM.pp", for now I have only added the part of the code commented on).
There are components that are used to convert the "Lazarus Form files" into Pascal code (
in this thread I learned how to use it thanks to wp). For now they do not do the job completely automatically, but they could be refined and adapted to produce a reversible conversion (from pascal code to lfm script and vice versa).
The advantage would not be to be underestimated, you could edit complex GUIs directly in pascal code and have the ".lfm" file regenerated for Lazarus. Also I think (I haven't checked yet and so the probability that I'm wrong is very high) that the compiler still needs a pre-conversion from ".lfm files" to pascal code before FPC can compile the project.
I believe that what I have said is achievable without having to make significant changes to the Lazarus-IDE.
(-: Thank you for having the patience to read my post. :-)
Otto.