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

Jorge Aldo G. de F. Junior jagfj80 at gmail.com
Tue Aug 21 21:42:32 CEST 2012

Instead of implementing the half-assed C++ namespace model, just add
to the compiler a warning when it detects that there is a collision in
the current scope (two functions with the same parameters from
different units that can be called from the scope being inspected). I
believe function overload alread provides the necessary hooks, but i
cant do it because i have zero experience with FPC sources...

2012/8/21 Marcos Douglas <md at delfire.net>:
> 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
> helped.
> 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
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

More information about the fpc-pascal mailing list