Op Fri, 18 Jan 2008, schreef Vinzent Höfler:

Maybe my view is skewed too much by the use of Ada where even a function declares a "record identifier". In Ada it is even possible to do:

---
procedure Test is

  X : Integer;

  procedure B is
     X : Integer;
  begin
     X      := 1;
     Test.X := 2; -- references X of "Test" procedure
  end B;

begin
  X := 3;
end Test;
---

There is fundamental problem which such a construct even using normal Pascal scoping rules. The identifier "test" in this case, is in the symtable of procedure B, which is a deeper lexical level, thus can hide global identifiers.

On the other hand:

uses a;

var a:byte;

... both unit a as variable a would go into the global symtable, which is the same lexical level, thus causing duplicate identifier conflicts.

Daniël
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to