[Lazarus] FPReport file names

Mattias Gaertner nc-gaertnma at netcologne.de
Thu Sep 14 00:43:34 CEST 2017


On Wed, 13 Sep 2017 21:57:50 +0200
Ondrej Pokorny via Lazarus <lazarus at lists.lazarus-ide.org> wrote:

>[...]
> > uses unitdots.unit1, unitdots;
> > type
> >    TPrgBright = unitdots.tbright;
> >    TPrgColor = unitdots.unit1.tcolor; <--
> > ...
> 
> I don't get it :)
> from left to right: is unitdots a namespace? -> yes -> is unit1 a 
> subnamespace in unitdots? -> no -> is unit1 a file in unitdots 
> namespace? -> yes -> find tcolor type in unitdots.unit1. Why do you need 
> to read the identifier backwards?

Sadly, there are no subnamespaces in Delphi. For example:

uses unitdots.foo.bar, unitdots;
t:=unitdots.foo.bla; // foo.bla is defined in unitdots

According to your approach:
Is unitdots a namespace -> yes -> is foo "subnamespace" -> yes -> find
bla in "unitdots.foo" -> does not exist.

 
> + Yes, I have a bug in CodeTools:
> 
> program unitdots.main1;
> uses unitdots, unitdots.unit1;
> type
>    TPrgBright = unitdots.tbright;
>    TPrgColor = unitdots.unit1.tcolor;
>    TStrange = unitdots.main1.tprgcolor;
> var k1: longint;
> begin
>    if unitdots.main1=0 then ; // << compiler error (codetools jump to 
> "main1: integer;" in unitdots.pas)

I fixed that some hours ago. The source name is a special case.


>    if unitdots.main1.k1=0 then ; // << OK (codetools don't find k1)
>    if unitdots.j1=0 then ;
>    if unitdots.unit1.i1=0 then ;
> end.
> 
> unit unitdots;
> interface
> type
>    tbright = (yes, no);
> var
>    main1: integer;
>    unit1: integer;
>    j1: integer;
> implementation
> end.
> 
> unit unitdots.unit1;
> interface
> type
>    tcolor = integer;
> var
>    i1: tcolor;
> implementation
> end.
> 
> The namespace/unitname takes precedence before an identifier in an 
> external unit.

Yes.

> But it still looks to me like everything can be resolved 
> from left to right - you just need to know the rules. CodeTools don't 
> know this rule yet. But once they know it, they will resolve it correctly.

To be honest, I have to lookup the rules from time to time. I wonder
why Delphi did not come up with more intuitive rules.

Mattias


More information about the Lazarus mailing list