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

Timothy Madden terminatorul at gmail.com
Tue Aug 21 18:29:30 CEST 2012


On 08/21/2012 06:06 PM, Marcos Douglas wrote:
> On Mon, Aug 20, 2012 at 1:15 PM, Timothy Madden <terminatorul at gmail.com> wrote:
[...]
>> Is there any form of proposal or some alternative to the USES clause,
>> that will keep all the imported symbol names qualified by some namespace
>> name or by some prefix I choose ?
>>
>> Something like:
>>         import System into sys, Math, Trigonometric into trig;
>> and then I would need to use trig.actg() as the only possible way to
>> refer to actg() function in the Trigonometric unit, and to use
>> Math.log() for logarithm ?
>>
>> Yes, I know I can qualify names even now if I so choose, but I was
>> thinking for a way to ensure that qualified names are the only
>> possibility, and a way that will allow me some shorter qualification,
>> because with the current qualified names, the qualified name can be
>> really long.
>>
>> Thank you,
>> Timothy Madden
> 
> I feel your pain.
> A long time ago this topic was talked here, on the list, and many
> ideas were proposed... but none was accepted or because no one will
> implement it.
> I proposed this sintaxe:
> uses my_long_unit_name as my;
> begin
>   my.proc();
> end

This is what I am also looking for, I think it is the only real solution.

Also, with this syntax, qualifing the symbol with "my." is the only way
to access the proc() symbol there, meaning that
begin
   proc();
end
will never work.

Sorry to hear no one will implement it, you would not say it is
difficult to do at a first glance...

Thank you,
Timothy Madden




More information about the fpc-pascal mailing list