Delphi – Justification for Using .inc Files in Delphi RTL Units

delphi

Starting with #Delphi #XE2 many of the new RTL units related to Vcl styles, OSX and so on, uses inc files to declare types, classes and implement code (just like the FPC does), what is the justification to do that? you can see what i mean if you inspect one of these folders (source\rtl\posix, source\rtl\posix\osx, source\rtl\sys )

Best Answer

Possibly to avoid duplicating this stuff in framework/platform specific units and without adding them to the most basic RTL units. Then again, that could also have been achieved with separate units. For type declarations that should really have been done. For implementation code I can see one reason to put it into an .inc file instead of its own unit: the code is relying on the Delphi specific rules regarding private class members (strict private was added to avoid this).