[fpc-pascal] How to avoid namespace name clashes after USES ?

Marcos Douglas md at delfire.net
Tue Aug 21 20:37:42 CEST 2012

On Tue, Aug 21, 2012 at 3:08 PM, Marco van de Voort <marcov at stack.nl> wrote:
> In our previous episode, Marcos Douglas said:
>> I proposed this sintaxe:
>> uses my_long_unit_name as my;
>> begin
>>   my.proc();
>> end
> This doesn't protect any better, since
> the new unit might also define "my".

True, but using this sintaxe I can use an alias to the third-party
units so, I can use my own names to reference identifiers that I can
not change.
The collision still can exists? Yes, but in that case the programmer
would be wrong, not third-party unit names or because the compiler not

The third-party could use a better and bigger name like "XyzNetSocket"
but I could use just "net" (uses XyzNetSocket as net), for example.

IMHO this is more sophisticated than pure namespace.

Marcos Douglas

More information about the fpc-pascal mailing list