alias = namespace [Re: alternative aliases [Re: [fpc-devel] Re: [fpc-pascal] Re: Ideas for namespace implementation]]

Martin fpc at
Mon Jul 26 18:51:08 CEST 2010

On 26/07/2010 17:32, Marcos Douglas wrote:
>>> using IN and ALIAS,
>>> - the developper should still attempt to use names that he hopes to be
>>> unique: MyFooStrUtils,instead of StrUtils
>>> - only in the rare case of a conflict, action is needed
>> Well... now that I know how you want those "in 'LCL'" things to work I tend
>> to prefer your solution... (I'm easy to convince, I know ^^).
>> Also it's backwards compatible if it is not used. Nice :D
> This is cool, but duplicate names may still exist.

True, but they always do:

- Currently you get duplicate unit names
- With namespaces you get duplicate namespace-names
- with search-path aliases, you get duplicate aliases

You can change the search-path alias of any package that yyou use, in 
the packages settings => that is quick and easy.

Of course that could leave you with 100 of units in your project, that 
point to the old alias....
Actually NO it could not.
You get the conflict, if you add a new package => so then you change the 
alias off the package that is new, and not yet referenced.

of course if you add 2 packages, which both rely on the alias FOO, but 
expect something differnet under foo,  ==> but then, you can specify 
different search-path aliases, for compiling each packages => solved again

And last not least, to reduce the amount of references to the search 
path aliases => you could use the program file to define glabal unit aliases

programm xxx;
uses FOO in 'LCL' alias 'LCLFOO',  unit1;

unit unit1;
uses LCLFOO; the alias from your program


maybe a similar "global" file could be used to define a package, and 
define global aliases for a package.
   Package SynEdit;

and to compila all units of the package, you compile th package file 
(same as the programm for your app)


More information about the fpc-devel mailing list