[fpc-devel] Re: [fpc-pascal] Re: Ideas for namespace implementation
Sven Barth
pascaldragon at googlemail.com
Mon Jul 26 17:50:15 CEST 2010
On 26.07.2010 17:40, Martin wrote:
> On 26/07/2010 16:34, Sven Barth wrote:
>>>> 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.
>>>
>>> Ok, so that means:
>>> If refering to the unit, or any element in it, you always have to use
>>> the full namespace:
>>> uses my.utils;
>>> var a: my.utils.TFoo;
>>>
>>> that is, inside the unit that uses the other unit, the other units name
>>> is effectively "my.utils" => with the dot being part of the name
>>>
>>> If writing a unit, that is to be in a namespace you can do
>>> unit utils namespace my;
>>> but that is no different from doing
>>> unit my.utils;
>>>
>>
>>
>> Not exactly, because
>>
>> 1)
>>
>> "unit utils namespace my" resides in "utils.pas"
>>
>> while
>>
>> "unit my.utils" resides in "my.utils.pas" (Delphi compatible).
>>
>> (no usage of compiler switch -Un here)
>
> That is a question of who the compiler is implemented to interpret this.
> "unit my.utils" could well reside in utils.pas
>
You're right... it could be defined like that as well.
>
>> 2)
>>
>> You can still do a
>>
>> uses
>> utils;
>>
>> with the namespace approach. The namespace-identifier is only needed
>> if you want/need to avoid a conflict.
>
> Now we are going in circles....
>
> that is the whole point I have been making for several males.
>
> The use of not fully qualified unit names is pure evil => it leads to
> mis interpretion by the reader.
>
> Telling the implementor, that he can use "sysutils" as unit name, will
> lead to the implementor doing eaxtly this => and the reader will be
> confused
Eh... right... there was something... shame on me.
Regards,
Sven
More information about the fpc-devel
mailing list