[fpc-devel] Purpose of "uses ... in"?

Daniël Mantione daniel.mantione at freepascal.org
Sun Jul 11 19:48:10 CEST 2010



Op Sun, 11 Jul 2010, schreef Hans-Peter Diettrich:

> I know that the "in <filespec>" is part of the Delphi syntax, but what is it 
> really good for?

In my opinion, it is not usefull. I have never seen a clear description of 
what the semantics should be, for example what happens if the code being 
compiled is found in the unit path, or if you point to a different 
directory than the current (i.e. "fpc subdir/unit.pas"). If you use it, 
you often also get into trouble with include files.

Another problem is that filename pathnames syntactically depend on the 
operating system.

In my opinion, the unit path (-Fu) is the proper way to instruct the 
compiler where it should search for your units. "uses ... in" is a Delphi 
relic we have inherited.

> AFAIK it's not allowed to "rename" units this way, and since (currently) only 
> absolute filenames are implemented, I really wonder why FPC allows to use it 
> everywhere?
>
> IMO the filespec should allow for relative pathes, and also the use of FPC 
> macros should be possible (e.g. FPCSourceDir).
>
> When there exists interest in such an extended functionality, but nobody has 
> the time to implement it, I'll try to implement it myself.

I am skeptical, but if you can make it more usefull...

Daniël


More information about the fpc-devel mailing list