[fpc-devel] Namespaces like URLs

Marcos Douglas md at delfire.net
Tue Jul 27 14:40:46 CEST 2010

On Mon, Jul 26, 2010 at 9:08 PM, Martin <fpc at mfriebe.de> wrote:
> On 26/07/2010 23:08, Graeme Geldenhuys wrote:
>> 2010/7/27 Adem :
>>> I wouldn't have much of an issue with something like
>>> uses
>>>  zip IN '/units/my/zip.pas' AS myzip;
>>>  zip IN '/units/lib/zip/zip.pas' AS ziplib;
>> And if you have multiple developers working on the same project and
>> their source code directory hierarchy is not exactly the same as yours
>> (shown above), then that project would not compile on there systems.
>> You cannot hard-code such paths inside a unit and have any hope that
>> it will be "portable" between developers and OSes (\ vs / delimiters).
> Thats why,. if you read the following thread:
> http://lists.freepascal.org/lists/fpc-devel/2010-July/021088.html
> you will see that there is a better solution

I writen the idea: "uses zip IN '/units/my/zip.pas' AS myzip;" above,
but I agree the Martin's idea is the better, as I said here:

> For each package, you must specify a search path (commandine or fpc.cfg)
> -Fu=path
> Extend it do declare an alias for the path (which then is your namespace
> -Fu=SynEdit::/path/to/symedit
> uses Utils in ':SynEdit' alias SynUtils

IMHO, use just one colon to path and nothing in "uses clause" like:
  Utils in 'SynEdit' alias SynUtils


More information about the fpc-devel mailing list