RES: [fpc-pascal] dot within unit file name
Vinzent Höfler
JeLlyFish.software at gmx.net
Fri Jan 18 18:36:02 CET 2008
Daniël Mantione wrote:
> 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.
Yes. That's precisely why in Ada you have to write "Test.X" to go up
that "lexical level". The hiding happens here, too - but you have the
possibility to explicitely override it.
(Let's put aside the fact, that such constructs are usually bad coding
style.)
> 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.
In Ada the fully qualified name of the variable would be "A.A" here.
I certainly see the problems for the (Pascal) compiler write here, but
from a user's point of view this identifier is in no way different than
"SysUtils.Sleep".
Vinzent.
More information about the fpc-pascal
mailing list