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

Sven Barth pascaldragon at googlemail.com
Wed Jul 28 11:23:40 CEST 2010


Am 27.07.2010 13:27, schrieb Martin:
> Great feedback, thanks.
>
> I added several point to
> http://wiki.lazarus.freepascal.org/Namespaces#Mapping_Namespace_to_each_search_path

Regarding the following point:

> It may be proposed, that if 2 units Utils exists, both must be aliased. Even though, if only one was aliased, they would have different names already.

Forcing to alias both units might not be a good idea. Consider the 
following:

You have a unit that uses Graphics and Windows (which both contain a 
type TBitmap).

uses
   Windows, Graphics;

(...)
var
   b: TBitmap;
   bm: Graphics.TBitmap; // I don't remember FPC's current order of 
resolution, but in this example Windows takes precedence over Graphics

You use the prefixed Graphics.TBitmap in quite a few locations in that unit.

Now you add a new package that has also some nice graphic routines (but 
no TBitmap for the sake of example ^^) that also reside in a unit graphics.

uses
   Windows, Graphics, Graphics in GraphicsPkg as PkgGraphics; // I just 
picked one of the syntaxes... no need to discuss this here ^^

Now if you force that both units are aliased you'd need to change all 
references of Graphics.TBitmap to e.g. LCLGraphics.TBitmap. While this 
can be done in an IDE or with Find & Replace I'd prefer that this is not 
needed, cause it's simply an unneccessary change.

Regards,
Sven




More information about the fpc-devel mailing list