[fpc-devel] Nested Classes used as Namespace Question

Sven Barth pascaldragon at googlemail.com
Mon Jan 10 10:27:14 CET 2011


Am 10.01.2011 05:15, schrieb Paul Ishenin:
> 10.01.2011 1:47, Andrew Brunner wrote:
>> Type
>> NS_APP=class
>> const
>> const1=2;
>> const3=5;
>> type
>> NS_SPACE1=class
>> type
>> Properties=(Name,Value);
>> TMyRecord=record
>> ID : integer;
>> Name:string;
>> Value:string;
>> end;
>> end;
>> NS_SPACE2=class
>> type
>> Properties=(Name,Value); // Duplicate Identifer "Name"
>> error @ compile
>> TMyRecord=record
>> Key : Array[0..1] of Byte;
>> Value : Pointer;
>> end;
>> end;
>> end;
> This is by design. Enumeration members are added both to the unit and
> enumration symbol table and therefore can't have equal names. If you
> want to prevent adding them to the unit symbol table use {$SCOPEDENUMS
> ON} directive. Then you will need to access them using prefixes only.
> Like NS_APP.NS_SPACE1.Properties.Name.

I should really enable some sort of notification for changes in the wiki 
pages "FPC New Features Trunk" and "User Changes Trunk"... then I won't 
miss the addition of such interesting features.

Regards,
Sven



More information about the fpc-devel mailing list