[fpc-devel] Re: [fpc-pascal] Re: Ideas for namespace implementation

Sven Barth pascaldragon at googlemail.com
Mon Jul 26 16:55:53 CEST 2010


Hi!

So... continuing the thread were it belongs... in fpc-devel :P

On 26.07.2010 16:36, Marcos Douglas wrote:
> On Mon, Jul 26, 2010 at 11:20 AM, Sven Barth
> <pascaldragon at googlemail.com>  wrote:
>>
>> What about that the compiler enforces that you use the fully qualified name
>> if you used it in the uses?
>
> Not only if you used it in the uses clause, but if you COMPILED with
> namespace sintaxe (eg. by Graeme unit strutils namespace my), IMHO...

The whole idea is to compile units with a namespace not just using on in 
the uses because it's funny.
Either its compiled by including "namespace Foo" in the units themselves 
or by using a commandline parameter "-namespace Foo", so that not every 
unit needs so be changed (both modes are supported and the "in unit" 
version takes precedence of the commandline one).

> But we would have a problem stated by Michael:
>
> On Mon, Jul 26, 2010 at 6:34 AM, Michael Van Canneyt
> <michael at freepascal.org>  wrote:
>> 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.

It's not about not having to type the "fully qualified name", but about 
not having to rename/prefix my own units, because they conflict with an 
existing unit.

> So... maybe create a new directive like as {$NAMESPACE ON}
>
> eg.
>
> {$NAMESPACE ON}
> unit strutils namespace my;
>
> With {$NAMESPACE ON} all units will have namespaces, unless FPC's units.

Can you explain what you want to achive with that directive, please? 
Currently I don't get that... :(

Regards,
Sven



More information about the fpc-devel mailing list