modular application (bpl / ppl) lazarus / 21-General ---------------------------------------------------------------------- pmesquita 路 2021-02-11 21:12 Guys, I'm new to Lazarus because I come from Delphi so I'm getting used to it ... How do you modularize your application? For example .. In delphi there are bpl that can be loaded and unloaded to call a form for example .. And in lazarus how is the process .. I've been reading about ppumove that you generate a .ppl with .ppu but always me gives the message "PPU is not static linked" 馃槙 ---------------------------------------------------------------------- jamie 路 2021-02-11 22:01 Are you talking about the Runtime package DLLs ? ---------------------------------------------------------------------- pmesquita 路 2021-02-12 12:30 Hello, Good Morning Almost this but instead of using a DLL I will use a package because I need to have access to objects created in other packages without passing the reference but just placing the package in the requires. basically this ... BPL: Code: Pascal 聽[Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure DoSomething ();begin聽 聽LogEvent ('Did');end;聽exports聽 聽DoSomething; Main EXE: Code: Pascal 聽[Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure CallModuleFunc;var聽 聽H: THandle;聽 聽P: procedure ();begin聽 聽H: = LoadPackage ('mymod.bpl');聽 聽try聽 聽 聽if (H <> 0) then聽 聽 聽begin聽 聽 聽 聽@P: = GetProcAddress (H, 'DoSomething');聽 聽 聽 聽if Assigned (P) then聽 聽 聽 聽FOR();聽 聽 聽end;聽 聽finally聽 聽 聽UnloadPackage (H);聽 聽end;end;聽https://stackoverflow.com/questions/39430980/how-to- dynamically-load-and-call-a-function-in-a-bpl-package ---------------------------------------------------------------------- PascalDragon 路 2021-02-12 14:20 Quote from: pmesquita on February 11, 2021, 10:12:23 pmGuys, I'm new to Lazarus because I come from Delphi so I'm getting used to it ... How do you modularize your application? For example .. In delphi there are bpl that can be loaded and unloaded to call a form for example .. And in lazarus how is the process .. I've been reading about ppumove that you generate a .ppl with .ppu but always me gives the message "PPU is not static linked" 馃槙 Dynamic loadable packages are not yet supported and are work in progress. ppumove only allows for static separation into modules (no dynamic loading) and even then its number of users is probably in the single digits (also it won't work on Windows where direct imports are not possible as they need to be indirect). Lazarus itself uses recompilation to allow the integration of custom packages. ---------------------------------------------------------------------- pmesquita 路 2021-02-12 14:47 Understand.. So for me to create a modular application I will have to create a static package and load everything on exe startup? or create them via DLL? Or is there another module to modularize an application? Because I currently have +/- 20 modules and I still need to develop the rest .. aff Are there any predictions for the support of dynamically loaded modules? ---------------------------------------------------------------------- jamie 路 2021-02-12 22:30 do these modules need to convey info between the main part and themselves ? You can have GUI stuff in DLL's its just that designer will not be able to provide that for you, you will need to manually do the code. Otherwise, you could use TProcess and use pipes to convey info.. ---------------------------------------------------------------------- Mr.Madguy 路 2021-02-13 05:21 You can always use ordinal DLLs instead of package DLLs, because you can always do something like this: Code: Pascal 聽[Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i //DLLfunction Factory:TMyObject;begin聽 Result := TMyObjectImplementation.Create;end;聽exports Factory;聽//EXEMyObject := Factory;聽Or even this: Code: Pascal 聽[Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i //DLLtype聽 TMyClass = class of TMyObject;聽function Factory:TMyClass ;begin聽 Result := TMyObjectImplementation;end;聽exports Factory;//EXEMyObject := Factory.Create;//Virtual constructor!!!聽Package DLLs are great only because they don't contain copies of other packages. For example if your DLL would use forms, it would content full copy of VCL/LCL, that is big. In case of package DLLs vclxxx.bpl would be shared between all other packages. ---------------------------------------------------------------------- pmesquita 路 2021-02-15 19:29 I don't usually work with DLLs that contain forms, but in my case the modularization will occur in each functionality, consisting of 1 or more forms where all of these are in a module (aka Package). So when creating the DLL that will contain these forms, will I have access to objects created globally in other DLLs? For example, currently I have a TDataModule where there is a connection to the database and I share it with the other modules (Uses DataModule ...) to access the objects I need ... In the dll will I be able to do this or just using static packages? and is there any example of how to link statically? ---------------------------------------------------------------------- PascalDragon 路 2021-02-16 08:11 Quote from: pmesquita on February 15, 2021, 08:29:45 pmFor example, currently I have a TDataModule where there is a connection to the database and I share it with the other modules (Uses DataModule ...) to access the objects I need ... Sharing objects between DLLs and the program is generally a bad idea and an accident waiting to happen. Quote from: pmesquita on February 15, 2021, 08:29:45 pmIn the dll will I be able to do this or just using static packages? and is there any example of how to link statically? You simply use the units as if there are no dynamic packages. Lazarus helps you there with its packages, which are essentially collections of units that it precompiles for you to statically use in your projects. ---------------------------------------------------------------------- Mr.Madguy 路 2021-02-16 08:28 Quote from: pmesquita on February 15, 2021, 08:29:45 pmI don't usually work with DLLs that contain forms, but in my case the modularization will occur in each functionality, consisting of 1 or more forms where all of these are in a module (aka Package). So when creating the DLL that will contain these forms, will I have access to objects created globally in other DLLs? For example, currently I have a TDataModule where there is a connection to the database and I share it with the other modules (Uses DataModule ...) to access the objects I need ... In the dll will I be able to do this or just using static packages? and is there any example of how to link statically? I guess, it's possible, but you'll need to do everything explicitly, so things will be much more complex. For example you wouldn't able to simply do "uses DataModule", because DataModule itself already contains whole implementation and you need to export some sort of "interface" to it from your DLL. You'll need to declare some abstract interface to your DataModule, like this: Code: Pascal 聽[Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i IDataModuleInterface = interface聽 function GetMyDataBaseConnection:TDataBaseConnection;聽 property MyDataBaseConnection:TDataBaseConnection read GetMyDataBaseConnection;end;聽Then implement it, export it and use it in other modules. Code: Pascal 聽[Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i //DLL聽function GetDataModuleInterface:IDataModuleInterface;begin聽 Result := TDataModuleInterface.Create(MyDataBaseConnection);end;聽exports GetDataModuleInterface;聽//Other module聽DataModule := GetDataModuleInterface;聽DataModule.MyDataBaseConnection.DoSomething;聽 Unfortunately Lazarus currently has different paradigm. I also thought, that modularization was just about good programming and design style. I.e. that "Save memory - don't load, what isn't needed now!" concept. But then I realized, that it's also about concept of propreitary soft. Plug-in based application is great, when it consist of many closed source modules and libraries, created by many different developers. But when your project is open source, so you have access to all sources, then it's considered to be more simple to just use "solid" design of your project, when everything is compiled into one single EXE. Remember? Linux kernel is solid. Having static code being "copy-pasted" between many applications is no longer considered bad, because modern computers have enough resources to handle it. Not many people today remember about working with 640K RAM and 20Mb HDDs. You should also understand, that FPC supports 64bit compiler and IDE, so it doesn't have memory limitation, Delphi has (at least had in older versions, not sure about today). For example it's that nasty "out of memory" error, that forces me to split my project into many smaller modules. ---------------------------------------------------------------------- pmesquita 路 2021-02-16 12:37 Quote from: Mr.Madguy on February 16, 2021, 09:28:39 amQuote from: pmesquita on February 15, 2021, 08:29:45 pmI don't usually work with DLLs that contain forms, but in my case the modularization will occur in each functionality, consisting of 1 or more forms where all of these are in a module (aka Package). So when creating the DLL that will contain these forms, will I have access to objects created globally in other DLLs? For example, currently I have a TDataModule where there is a connection to the database and I share it with the other modules (Uses DataModule ...) to access the objects I need ... In the dll will I be able to do this or just using static packages? and is there any example of how to link statically? I guess, it's possible, but you'll need to do everything explicitly, so things will be much more complex. For example you wouldn't able to simply do "uses DataModule", because DataModule itself already contains whole implementation and you need to export some sort of "interface" to it from your DLL. You'll need to declare some abstract interface to your DataModule, like this: Code: Pascal 聽[Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i IDataModuleInterface = interface聽 function GetMyDataBaseConnection:TDataBaseConnection;聽 property MyDataBaseConnection:TDataBaseConnection read GetMyDataBaseConnection;end;聽Then implement it, export it and use it in other modules. Code: Pascal 聽[Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i //DLL聽function GetDataModuleInterface:IDataModuleInterface;begin聽 Result := TDataModuleInterface.Create(MyDataBaseConnection);end;聽exports GetDataModuleInterface;聽//Other module聽DataModule := GetDataModuleInterface;聽DataModule.MyDataBaseConnection.DoSomething;聽 Unfortunately Lazarus currently has different paradigm. I also thought, that modularization was just about good programming and design style. I.e. that "Save memory - don't load, what isn't needed now!" concept. But then I realized, that it's also about concept of propreitary soft. Plug-in based application is great, when it consist of many closed source modules and libraries, created by many different developers. But when your project is open source, so you have access to all sources, then it's considered to be more simple to just use "solid" design of your project, when everything is compiled into one single EXE. Remember? Linux kernel is solid. Having static code being "copy-pasted" between many applications is no longer considered bad, because modern computers have enough resources to handle it. Not many people today remember about working with 640K RAM and 20Mb HDDs. You should also understand, that FPC supports 64bit compiler and IDE, so it doesn't have memory limitation, Delphi has (at least had in older versions, not sure about today). For example it's that nasty "out of memory" error, that forces me to split my project into many smaller modules. Of course, I understood your point of view .. but the question of compiling everything using static modules is currently no problem, since most of the existing hardware has at least 4Gb of RAM so memory is not a problem. What I see as a problem is updates, for example, attached there is a small project that consists of: an Exe and 3 Packages; being that 1 of these packages is a TObject class that will be the manager of the modules .. instead of referencing all uses of the forms I need, I only reference 1 and access the object created in the OnCreate of the Exe. The problem starts if I update an item from Form01 .. I will have to recompile the Exe and in order to update I will have to end the program on the client copy the exe ... however over time the Exe will start to get big, of course everything is linked statically, and for a simple correction I will have to copy via internet, for example, a 50Mb exe instead of a 1Mb (bpl / ppl) maybe containing a simple correction in a function used only by this module. So in my project that I intend to port I use only 1 TDataModule package where I create the connection with the BD and other smaller TObjects. What would be advised in my case is: Create an Exe and: Classes that do not use objects: DLLs <- Most functions that take parameters and return the result. Classes that use objects already created in the exe: I create an Interface for these objects (as in your example) and create the forms in the DLLs and access the object in the form of the DLL using this interface. Because using DLL I can use LoadLibrary so I have modularization Would it be more or less this or am I totally wrong and I better keep silent .. ? ---------------------------------------------------------------------- pmesquita 路 2021-02-16 15:04 Quote from: jamie on February 12, 2021, 11:30:18 pmdo these modules need to convey info between the main part and themselves ? You can have GUI stuff in DLL's its just that designer will not be able to provide that for you, you will need to manually do the code. Otherwise, you could use TProcess and use pipes to convey info.. Sorry, I didn't see your message .. in most cases only a notification message that some process has been carried out and that the form that depends on this action is notified to start its procedures. But data exchange between forms are very few ... ---------------------------------------------------------------------- Mr.Madguy 路 2021-02-17 07:05 Quote from: pmesquita on February 16, 2021, 01:37:10 pmOf course, I understood your point of view .. but the question of compiling everything using static modules is currently no problem, since most of the existing hardware has at least 4Gb of RAM so memory is not a problem. What I see as a problem is updates, for example, attached there is a small project that consists of: an Exe and 3 Packages; being that 1 of these packages is a TObject class that will be the manager of the modules .. instead of referencing all uses of the forms I need, I only reference 1 and access the object created in the OnCreate of the Exe. The problem starts if I update an item from Form01 .. I will have to recompile the Exe and in order to update I will have to end the program on the client copy the exe ... however over time the Exe will start to get big, of course everything is linked statically, and for a simple correction I will have to copy via internet, for example, a 50Mb exe instead of a 1Mb (bpl / ppl) maybe containing a simple correction in a function used only by this module. So in my project that I intend to port I use only 1 TDataModule package where I create the connection with the BD and other smaller TObjects. What would be advised in my case is: Create an Exe and: Classes that do not use objects: DLLs <- Most functions that take parameters and return the result. Classes that use objects already created in the exe: I create an Interface for these objects (as in your example) and create the forms in the DLLs and access the object in the form of the DLL using this interface. Because using DLL I can use LoadLibrary so I have modularization Would it be more or less this or am I totally wrong and I better keep silent .. ? Answer would be - we are in 5G Internet era, why bother about update size? I also like modularization. I like whole idea of being able to change just one module without recompiling whole project. I like idea of allowing user to customize my application without seeing it's source code and knowing anything about coding at all - just via adding/removing some plug-ins to it. That's, how I was brought up. And it's also the way, how complex projects work. Yeah, simple project can be solid. But once project starts to be complex enough, some modularization becomes unavoidable. I don't want to insult anybody. Lazarus team is doing great job. But many open source teams suffer from "I don't need it and therefore nobody needs". That's why many open source projects are getting stuck in "obsoleted" state, like "I liked Win9x interface, so let's keep it forever". But truth is very simple. New features are implemented for reason. Because they make certain tasks easier. Simply saying "I personally feel, that we don't need them" - is wrong approach. If you want people to migrate from Delphi, then first thing, you need to aim at - is Delphi compatibility. C++ projects are so compact exactly because they use C++ runtime. And runtime packages - are great attempt to achieve the same goal on Pascal. Especially due to simple fact, that Delphi IDE itself is very complex project itself, so it would be hard to imagine it without runtime packages. And on Delphi switching to using runtime packages - is the matter of checking just one option. I've also got tired of constantly saying, that 12 years passed since release of D2009 and Lazarus still isn't fully D2009-compatible. Ok. May be we don't need things, like multiple inheritance. But closures are extremely important. They're easy way to implement callbacks with some arbitrary data, attached to them. I use them for test cases in my unit tests. They allow me to pass any data to that test cases without doing it explicitly - via function parameters or via object properties. And switching back to using classes and methods just isn't possible. There are thousands of that test cases. That's why it's so important to keep their code as minimal, as possible. It has taken several years to develop this project. I just can't do it all from scratch. ---------------------------------------------------------------------- PascalDragon 路 2021-02-17 08:11 Quote from: pmesquita on February 16, 2021, 01:37:10 pmWhat I see as a problem is updates, for example, attached there is a small project that consists of: an Exe and 3 Packages; being that 1 of these packages is a TObject class that will be the manager of the modules .. instead of referencing all uses of the forms I need, I only reference 1 and access the object created in the OnCreate of the Exe. The problem starts if I update an item from Form01 .. I will have to recompile the Exe and in order to update I will have to end the program on the client copy the exe ... however over time the Exe will start to get big, of course everything is linked statically, and for a simple correction I will have to copy via internet, for example, a 50Mb exe instead of a 1Mb (bpl / ppl) maybe containing a simple correction in a function used only by this module. More often than not the static executable is smaller than the executable plus the packages, because the compiler and linker can better optimize things inside a single binary. To quote from another thread the sizes of the chmls utility with and without packages from around a year ago: Quote from: PascalDragon on January 23, 2020, 10:15:28 amQuote from: Mr.Madguy on January 23, 2020, 09:34:16 amIf Lazarus will ever support runtime packages, it's exe files will also become small. Then one needs into account the size of the packages. Here is a look at the sizes (in Byte) for chmls if using dynamic packages I did two months ago: Quote from: Win322633984 rtl.dll 414820 rtl.objpas.dll 247060 rtl.extra.dll 364625 rtl.generics.dll 389888 fcl.res.dll 788664 fcl.base.dll 962560 fcl.xml.dll 953676 chm.dll 68694 chmls.exe Quote from: Win643707538 rtl.dll 601446 rtl.objpas.dll 345340 rtl.extra.dll 459357 rtl.generics.dll 568559 fcl.res.dll 1187518 fcl.base.dll 1602915 fcl.xml.dll 1419896 chm.dll 85131 chmls.exe For comparison the sizes of chmls without packages: Win32: 460288 Win64: 623104 You can see that in total the size of the packages is much larger than the size for the statically linked executable. Quote from: Mr.Madguy on February 17, 2021, 08:05:42 amI don't want to insult anybody. Lazarus team is doing great job. But many open source teams suffer from "I don't need it and therefore nobody needs". That's why many open source projects are getting stuck in "obsoleted" state, like "I liked Win9x interface, so let's keep it forever". But truth is very simple. New features are implemented for reason. Because they make certain tasks easier. Simply saying "I personally feel, that we don't need them" - is wrong approach. If you want people to migrate from Delphi, then first thing, you need to aim at - is Delphi compatibility. You are wrong here. Dynamic packages is something that Lazarus devs definitely want. But it's also a rather complicated and involved functionality. Quote from: Mr.Madguy on February 17, 2021, 08:05:42 amC++ projects are so compact exactly because they use C++ runtime. And runtime packages - are great attempt to achieve the same goal on Pascal. Especially due to simple fact, that Delphi IDE itself is very complex project itself, so it would be hard to imagine it without runtime packages. And on Delphi switching to using runtime packages - is the matter of checking just one option. Your forgetting something: usually the C++ runtime is provided by the operating system vendor (Microsoft, Apple, the various Linux distributions), so you usually don't have to provide it with your application (though at least on Windows more often than not the installers will provide the redistributable runtime as well in case the OS does not have it installed yet). I don't see this for neither Delphi nor FPC/Lazarus applications, so you'll have to ship the whole load of dynamic packages nevertheless. (Note: yes, on Linux distributions they might provide the dynamic packages through their package systems, but that still leaves Windows and macOS) Quote from: Mr.Madguy on February 17, 2021, 08:05:42 amI've also got tired of constantly saying, that 12 years passed since release of D2009 and Lazarus still isn't fully D2009-compatible. Ok. May be we don't need things, like multiple inheritance. But closures are extremely important. They're easy way to implement callbacks with some arbitrary data, attached to them. I use them for test cases in my unit tests. They allow me to pass any data to that test cases without doing it explicitly - via function parameters or via object properties. And switching back to using classes and methods just isn't possible. There are thousands of that test cases. That's why it's so important to keep their code as minimal, as possible. It has taken several years to develop this project. I just can't do it all from scratch. Then provide patches! We only have so much time we can invest ourselves and we have lives outside of FPC as well! Implement for example Extended RTTI. (Anonymous Functions are too far along to reimplement them and hopefully I'll have good news about them soon ) Also where did that "multiple inheritance" thing come from? ---------------------------------------------------------------------- Mr.Madguy 路 2021-02-17 11:12 Quote from: PascalDragon on February 17, 2021, 09:11:10 amYour forgetting something: usually the C++ runtime is provided by the operating system vendor (Microsoft, Apple, the various Linux distributions), so you usually don't have to provide it with your application (though at least on Windows more often than not the installers will provide the redistributable runtime as well in case the OS does not have it installed yet). I don't see this for neither Delphi nor FPC/Lazarus applications, so you'll have to ship the whole load of dynamic packages nevertheless. (Note: yes, on Linux distributions they might provide the dynamic packages through their package systems, but that still leaves Windows and macOS) No, VS is separate product. You're always required to download and install C++ runtime manually, if you haven't done it yet, when installing some previous application. Same with Delphi runtime packages. They're contained in Redist folder, they're about 75Mb, and, if only Delphi would be more popular, it would provide some standard way to install them to Windows\System32 directory, so all applications on computer would have access to them. But now it's up to programmer himself to do it. And majority avoids putting something to system directory. They prefer current project's directly instead. Quote from: PascalDragon on February 17, 2021, 09:11:10 amThen provide patches! We only have so much time we can invest ourselves and we have lives outside of FPC as well! Implement for example Extended RTTI. (Anonymous Functions are too far along to reimplement them and hopefully I'll have good news about them soon ) Also where did that "multiple inheritance" thing come from? At some point I wanted to implement missing features by myself. But it would take too much time to find out, how to properly do it. And I already have two projects - support project and main project, that requires it. Support project constantly slips, that slows main project down. If I also would be required to support compiler itself, my project would never move off dead point. So I decided to just wait. Problem is - this waiting takes years. "Multiple inheritance" comes from C++. My project is very complex. It requires thing, called "multiple virtual polymorphism", i.e. when one object is assembled from several others, that behave like "drivers", but should share the same data between them. It's all about reusing existing code. I just hate, when I need to copy-paste implementations, cuz class can't be inherited from implementation directly, because it has to be inherited from other class. Current way to do it - is class composition. But this solution is ugly. It causes many problems. Such as need to implement many stubs, pass and store pointers to shared data and problems with tracking changes. It's not as easy, as just wringing just one line of code - TMyObject = TComplexObject. And that's it! Virtual inheritance does all the jobs for you! Currently I can avoid this problem. Partially via using interfaces, because they allow me to "split" inheritance tree. I.e. interfaces have their own inheritance tree and implementations can have their own. But this overcomplicates my project. I have to deal with many tricks, that make things more complex. ---------------------------------------------------------------------- PascalDragon 路 2021-02-17 12:30 Quote from: Mr.Madguy on February 17, 2021, 12:12:00 pm"Multiple inheritance" comes from C++. My project is very complex. It requires thing, called "multiple virtual polymorphism", i.e. when one object is assembled from several others, that behave like "drivers", but should share the same data between them. It's all about reusing existing code. I just hate, when I need to copy-paste implementations, cuz class can't be inherited from implementation directly, because it has to be inherited from other class. Current way to do it - is class composition. But this solution is ugly. It causes many problems. Such as need to implement many stubs, pass and store pointers to shared data and problems with tracking changes. It's not as easy, as just wringing just one line of code - TMyObject = TComplexObject. And that's it! Virtual inheritance does all the jobs for you! I had thought you meant in context of Delphi, because you wrote this (emphasis mine): Quote from: Mr.Madguy on February 17, 2021, 08:05:42 amI've also got tired of constantly saying, that 12 years passed since release of D2009 and Lazarus still isn't fully D2009-compatible. Ok. May be we don't need things, like multiple inheritance. We will not support multiple inheritance by ourselves however. On the mailing list we're currently discussing a somewhat related topic however (see here), though it might not help you for your specific problem. ---------------------------------------------------------------------- Mr.Madguy 路 2021-02-17 13:03 Quote from: PascalDragon on February 17, 2021, 01:30:05 pmQuote from: Mr.Madguy on February 17, 2021, 12:12:00 pm"Multiple inheritance" comes from C++. My project is very complex. It requires thing, called "multiple virtual polymorphism", i.e. when one object is assembled from several others, that behave like "drivers", but should share the same data between them. It's all about reusing existing code. I just hate, when I need to copy-paste implementations, cuz class can't be inherited from implementation directly, because it has to be inherited from other class. Current way to do it - is class composition. But this solution is ugly. It causes many problems. Such as need to implement many stubs, pass and store pointers to shared data and problems with tracking changes. It's not as easy, as just wringing just one line of code - TMyObject = TComplexObject. And that's it! Virtual inheritance does all the jobs for you! I had thought you meant in context of Delphi, because you wrote this (emphasis mine): Quote from: Mr.Madguy on February 17, 2021, 08:05:42 amI've also got tired of constantly saying, that 12 years passed since release of D2009 and Lazarus still isn't fully D2009-compatible. Ok. May be we don't need things, like multiple inheritance. We will not support multiple inheritance by ourselves however. On the mailing list we're currently discussing a somewhat related topic however (see here), though it might not help you for your specific problem. I'm not even 100% sure, if I need it. I'm trying to overhaul my project to avoid it now and it's possible, that I'll succeed. Overall what I need - is something like "automated class composition". I.e.when at some point part of class can be abstract and it's implementation can be bound later, so this code can be reused. But without class composition, because class composition requires passing references to some data inside main class and if that implementation should implement some of class's methods, then stub is required, that is just extra work and waste of code. What suits me - is virtual multiple inheritance. For example: Code: Pascal 聽[Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i TAbstractObject = class聽 function GetSomething:Integer;virtual;abstract;聽 procedure DoSomething;end;聽TMyObject = class(TSomeBaseObject, TAbstractObject:virtual);//This can't be directly inherited from TAbstractObject聽 X:Integer;聽 function GetSomething;override;//At the same time we can easily pass something to TAbstractObjectend;聽TMyChild = class(TMyObject)聽 procedure DoSomethingElse;//Uses DoSomething and/or extends it's functionalityend;聽TImplementation = class(TAbstractObject)聽 procedure DoSomething;override;//Implementationend;聽TFinalObject = class(TMyObject, TImplementation:override);//Assembling object via just one line of code!!!!!聽TFinalChildObject = class(TMyChild, TImplementation:override);//TImplementation code is shared between this two!!!!!聽Now just imagine, how longer and more complex would this code be, if it would be made via using class composition.