[fpc-devel] Namespaces like URLs

Adem listmember at letterboxes.org
Tue Jul 27 00:01:27 CEST 2010


  On 2010-07-26 11:31 PM, Marcos Douglas wrote:
> Please, see that:
> http://lists.freepascal.org/lists/fpc-devel/2010-July/020699.html
> http://lists.freepascal.org/lists/fpc-devel/2010-July/020791.html
> http://lists.freepascal.org/lists/fpc-devel/2010-July/020856.html
> http://lists.freepascal.org/lists/fpc-devel/2010-July/020934.html
I had read them at the time.

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;


except that it seems (to me, at least) to declare what we are doing before doing it.

I mean, it might be more pascal-like if we did it like this:

uses
  alias myzip in '/units/my/zip.pas';
  alias ziplib in '/units/lib/zip/zip.pas';

so that, the parser knows -before hand- what is to follow.

But, this handles only the aliasing.

In the above example, the '/units' folder is relative --I assume-- to 
the project and not relative to an (so to speak) URL, i.e. namespace.
Which means, if you moved that folder elsewhere, you'd have to alter 
each and every place it is aliased.

Obviously, there is no perfect solution to units-moved problems, but if 
we treated namespcaes as URLs, then we could simply move the whole 
folder structure of that project somewhere else and only have to reflect 
that change in one place. I.e. in the project file where 'namespace's 
are declared.

Anyway, it goes without saying that this is just an idea.



More information about the fpc-devel mailing list