[fpc-pascal] How to avoid namespace name clashes after USES ?
Marcos Douglas
md at delfire.net
Wed Aug 22 03:32:33 CEST 2012
On Tue, Aug 21, 2012 at 6:29 PM, Jorge Aldo G. de F. Junior
<jagfj80 at gmail.com> wrote:
> the alias is the fully qualified function name :
>
> myunit1.function1()
> myunit2.function2()
Yes, we know..
> you dont need alias, cause you cant have two units with the same name,
> so you have two different fully qualified function names.
Yes, we know too... but how prevent this using third-party libs?
For example, what do you think if I have a project that have a file
called lnet.pas? Can I use this identifier? I think so... WAIT, I
can't because the lnet project already uses, right? But I didn't know
before...ohh my... and now, I can't use this project because I will
got a compiler error because "cant have two units with the same name".
Do you think this is right?
Because of this conflict that I proposed the syntax:
uses
foounit as f1 in '/path_1/foounit.pas',
foounit as f2 in '/path_2/foounit.pas';
But this sintaxe is just to resolve a conflict, isn't default
configuration, of course.
> The warning would simply point out that there are two functions with
> the same name and parameters in the current scope, because thats the
> only possible conflict.
Yeah, I understood and I think this is a great idea (too).
> Requiring all functions to be allways fully qualified will make the
> most commom case worse than current implementation just to be better
> for the uncommon case. This is a step back, not forward...
Timothy Madden want this, not me. ;-)
Marcos Douglas
More information about the fpc-pascal
mailing list