[fpc-pascal] Ideas for namespace implementation

"Vinzent Höfler" JeLlyFish.software at gmx.net
Tue Jul 27 10:44:06 CEST 2010


> On 26 July 2010 19:26, Thierry Coq <tcoq at free.fr> wrote:
> >
> > I see units as namespaces already existing: we use the unit names to
> > prefix
> > ambiguous function or variable names for example.
> 
> Unit Names give very limited namespace support - which only applies to
> types or procedures/functions or global variables (anything in the
> interface section of a unit).

And that sure is enough - unless you want to extend to Ada's package concept (which in fact is more than just "namespace") and even there you are not immune to name conflicts. I suppose you know that as you were the one who suggested it. ;)

But then, IME (most) name conflicts are a sure sign of inproper names. Take the example of "constants.pas": What sort of constants shall I expect there? Screen sizes, color codes, electron mass or the gravitational constant?

Namespaces are a clutch added to C++ because being stuck with C-compilers they simply had no proper solution. Remember, in C _every_ visible identifier is in the same scope. There are no "units".


Vinzent.
-- 
Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief!  
Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail



More information about the fpc-pascal mailing list