[fpc-pascal] dot within unit file name
Matt Emson
memsom at interalpha.co.uk
Fri Jan 18 14:54:40 CET 2008
Marco van de Voort wrote:
> However again, as far as I understand partial classes (Class
> Helpers in Delphi.NET), for this you need a registration system again because you need
> to compile all units that might use class X so that they auto import all
> units with classhelpers for unit X. (or you have to scan all directories
> on each compiler start, and must make 100% sure that you don't use units
> that don't have these class helpers added.
>
Not really. In practice, you can compile a partial class without all of
its parts and use it just fine. In the real world, this is extremely
useful in sharing an engine between GUI systems (or a web application
and a Console application) without pulling in specifics for the role
implemented (GUI kits etc). It allows for a modular design (extensions
at compile time.) It allows the programmer to create a flatter less
complex hierarchy - e.g MVC in a single class, but with clear separation
of responsibility.
In C#, Vs2005 always buts all of the GUI generation code in to a partial
class called XXX.Designer.cs. This is an extreme improvement over the
Pascal way.
An extention to this would be partial units (just invented this) which
would allow the removal of the include files that dog FPC's RTL and
support libs. All specific files could be organised in such a way that
the include path found only the correct unit parts.
Yes, this is all a pipe dream, but dreaming is fun sometimes ;-)
M
More information about the fpc-pascal
mailing list