[Lazarus] FPReport file names
Michael Van Canneyt
michael at freepascal.org
Wed Sep 13 11:28:55 CEST 2017
On Wed, 13 Sep 2017, Mattias Gaertner via Lazarus wrote:
> On Wed, 13 Sep 2017 10:44:23 +0200 (CEST)
> Michael Van Canneyt via Lazarus <lazarus at lists.lazarus-ide.org> wrote:
>
>> [...]
>> As long as there are no command-line switch and directive for setting
>> namespaces, they are completely useless. And even with them, the benefit is
>> doubtful.
>>
>> The benefit of writing fpreport.exporthtml versus fpreportexporthtml is zero.
>
> It's a little bit better than zero. For example shorter uses clause.
Without using a switch to set namespaces ? Please Explain ?
>> os.utils.pas(14)
>> testns.dpr(6) Error: E2003 Undeclared identifier: 'webfunction'
>> testns.dpr(7)
>>
>> webfunction is in the web.utils.pas unit.
>
> Did you add "uses utils"?
Yes, obviously. Here is the test program:
program testns;
uses utils;
begin
writeln(webfunction);
end.
unit web.utils;
interface
function webfunction : string;
implementation
function webfunction : string;
begin
Result:='web';
end;
end.
unit os.utils;
interface
function osfunction : string;
implementation
function osfunction : string;
begin
Result:='os';
end;
end.
> There is no switch to use "web.*" like in Java.
In Delphi there is: /NSweb.
But as soon as you use 2 namespaces (/NSos /NSWeb), you are stuck.
As you see from the output I posted, it compiles first os.utils
and uses that to satisfy the "uses utils;".
To be complete: it depends on the order of the NS switches, if you reverse
the order, it will work - but that doesn't help if you have a big project
which has many units using utils from one or the other namespace.
The first one wins.
>> So, to disambiguate, that forces me to write
>>
>> uses web.utils;
>
> "uses utils" should be enough.
As I demonstrated: it clearly is not.
I carefully tested everything before posting my remark.
Michael.
More information about the Lazarus
mailing list