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

Marcos Douglas md at delfire.net
Tue Aug 21 19:09:25 CEST 2012


On Tue, Aug 21, 2012 at 1:29 PM, Timothy Madden <terminatorul at gmail.com> wrote:
> 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.

"Never work", hum... ,maybe a compiler directive to ON/OFF this
feature would be better.

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

I think the FPC core did not like or does not care. If has no one to
implement it is a problem too. =(

Marcos Douglas



More information about the fpc-pascal mailing list