[fpc-pascal] Feature announcement: default namespaces

Sven Barth pascaldragon at googlemail.com
Sun May 6 09:40:23 CEST 2018


Ryan Joseph <ryan at thealchemistguild.com> schrieb am So., 6. Mai 2018, 09:16:

>
>
> > On May 6, 2018, at 1:46 PM, Mattias Gaertner <nc-gaertnma at netcologne.de>
> wrote:
> >
> > He meant:
> > If you use units with namespaces and you can't use the -FN option, then
> > it becomes cumbersome to write them. Then a unit directive would be
> > nice to have.
>
> But does FPC have actual namespaces besides prefixing unit names? What
> exactly are "units with namespaces”?
>

They are also named "dotted units" and as I wrote in y announcement mail
Object Pascal doesn't have namespaces in the sense of languages like C#,
C++ or Java that allow for deep hierarchies and such.
The namespaces in Object Pascal are merely a convenience thing. E.g. Delphi
prefixed many of the existing units (like SysUtils became System.SysUtils,
Windows became WinApi.Windows and Forms became VCL.Forms (or so)). They did
this so that FireMonkey units can share unit names with the VCL (e.g.
FMX.Forms). But to keep backwards compatibility with old code Delphi
projects have by default their default namespace list set to something like
"System, WinApi, VCL" so that such code continues to compile.

In FPC we currently don't use dotted unit names much, but maybe that will
change in the future.

Regards,
Sven

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20180506/3a04aaaf/attachment.html>


More information about the fpc-pascal mailing list