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 ?

so
----------------------------
unit a.b.c;

interface

Var
  D : Integer;

implementation

end.
----------------------------

and then:
----------------------------

unit test;

interface

uses a.b.c;

Type
  T = record
   b : integer;
  end;

Implementation

var
  A : T;

begin
  A.b.c.d:=3;// ???
end.
----------------------------
 
To the user, it may appear as a bunch of dots. To the compiler, it doesn't
know how to map the a.b.c.d:

1. Scoping rules dictate that the first match is the variable a.  
   So, it finds a as a variable. 
2. then it finds b in the fields of T. OK, it's on the right track! 
3. But then it looks for C, but doesn't find it -> error, what now ?

nevertheless (a.b.c).d would be a correct reference to integer d in unit a.b.c
(the brackets serve just to make a point, they are not real notation).

So, what to do ? Throw an error, or set d in unit a.b.c. ?
And what about searching for (a).b.c.d and (a.b).c.d ? What combinations of
dots and brackets must be tried ? (namespaces could also be a and a.b)

Maybe someone with delphi for .net available can run the above test ?

Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to