RES: [fpc-pascal] dot within unit file name
Michael Van Canneyt
michael at freepascal.org
Fri Jan 18 16:28:13 CET 2008
On Fri, 18 Jan 2008, Vinzent Hoefler wrote:
> On Friday 18 January 2008 15:50, Michael Van Canneyt wrote:
> > On Fri, 18 Jan 2008, Vinzent Hoefler wrote:
> > > On Friday 18 January 2008 15:19, Michael Van Canneyt wrote:
> > > > > I saw this week a CodeGear Guy in a cg ng talking about that.
> > > > > In Win32 its is Just dots in the name, nothing else.
> > > >
> > > > If he said that, he is totally braindead and doesn't have a clue
> > > > about what he is talking.
> > >
> > > Well, the discussion and explanation that have been provided so
> > > far, back up that braindead guy's statement.
> >
> > Of course not:
> >
> > tell me, what does a.b.c.d mean if you have a record a with field b,
> > and you have a uses a.b.c in your uses clause ?
>
> The magic word would be "scope" here. It's the same as with using two
> different units including the same identifier twice.
>
> Running up the scope until the identifier is either found or not.
>
>
> Same with:
>
> ---
> unit
> A;
>
> var
> C : ...
> D : ...
> ---
>
> ---
> function Blubb;
> A : Record_Type;
> begin
> A.D :=
> A.C :=
> end
> ---
>
> AFAIK this would be perfectly compilable already. (I'm in a hurry right
> now, but I guess, you catch my drift.)
You are wrong. It does not compile, neither in delphi, nor in FPC.
D is not found, because 'A' resolves to the local a, and then the
search is stopped.
-----------------------------------
unit a;
interface
Var
D : Integer;
implementation
end.
-----------------------------------
unit b;
interface
uses a;
Type
T = Record
C : integer;
end;
Implementation
Procedure Doit;
Var
A : T;
begin
A.C:=1;
A.D:=2;
end;
end.
-----------------------------------
Michael.
More information about the fpc-pascal
mailing list