[fpc-pascal] Re: Ideas for namespace implementation

Michael Van Canneyt michael at freepascal.org
Mon Jul 26 11:34:10 CEST 2010

On Sun, 25 Jul 2010, Graeme Geldenhuys wrote:

> On 25 July 2010 23:30, Michael Van Canneyt wrote:
>> The discussion is not about namespaces. Object Pascal HAS namespaces,
>> namely units. The discussion is about 'enhancing' the namespace to allow one
>> or more dots in the name.
> With the importance that the '.' is only needed when resolving a
> conflict - all other instances, you will just use the unit name as
> normal. Also, the '.' usage is only limited to the uses clause. At
> least we will be able to easily use more logical unit names without
> the fear of getting unit name conflicts.

Well, I fail to see what is more logical in my.constants than in myconstants.
The unit is still called my.constants, not constants. So you'll end up
typing my.constants everywhere anyway. The gain of this over myconstants is
highly debatable.

Since (as jonas points out) it introduces an ambiguity and violates the rule
that a unit name must be a pascal identifier, the pros must be weighed against 
the contras. The contras are known.

The only pro argument that carries any weight is Delphi compatibility. 
All the rest is a matter of personal opinion.

Given that, I suspect that if someone supplied a patch that allows dotted
unit names *in delphi mode* (with matching resolving algorithm), it would 
not be rejected. But I also wouldn't hold my breath waiting for one of 
the core developers to implement it. Clearly, none of them sees the need for
it, at least that should have become obvious from the thread.


More information about the fpc-pascal mailing list