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

Michael Müller mueller_michael at alice-dsl.net
Sun Jul 11 23:31:35 CEST 2010

Am 11.07.2010 um 19:48 schrieb Daniël Mantione:

> 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.

In Delphi IDE it is needed to include a unit into the 'Find in project files' search a word in the code. This is the reason why all of your codes use this syntax. 

> 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?

Who said that it works only with absolute filenames? We use relative paths like '..\foo\foo.pas' or  '..\..\foo\foo.pas' under Windows and it works with FPC 2.4.0 (but it already worked with 2.2.4).



More information about the fpc-devel mailing list