[Lazarus] Nested Classes used as Namespace Issue
Sven Barth
pascaldragon at googlemail.com
Mon Jan 10 20:48:14 CET 2011
On 10.01.2011 17:50, Razvan Adrian Bogdan wrote:
> On Mon, Jan 10, 2011 at 6:43 AM, Andrew Brunner
> <andrew.t.brunner at gmail.com <mailto:andrew.t.brunner at gmail.com>> wrote:
>
> type
> ns=class
> Type
> Vendor=class
> Const
> id = "ITMID';
> Size = 'ITMSIZE';
> Type
> PVendor=^TVendor;
> TVendor=record
> ID : Int64;
> Size : Integer;
> end;
> class procedure Foo();
> end;
> Supplier=class
> // example
> class procedure Foo();
> end;
> end;
> end;
>
> Neither ns.Supplier.Foo() nor ns.Vendor.Foo() will not jump to the
> actual code in Lazarus IDE. It kind of muddles nested classes (as
> namespaces) that FPC supports. Is this on someones list of todos?
>
> Interesting stuff, it's like nested records, but wouldn't this look
> nicer if the "type" keyword was optional, maybe only required where
> there is not keyword like class or record ? This looks like a nice
> feature but it shouldn't make code less readable by requiring keywords
> that only make the source more ugly.
In Pascal all type declarations appear in blocks that are named "type".
This is the case in global unit scope, in local method scope and in
class scope as well. So I don't think one should brake with the way
Pascal works just to create code that looks more beautiful.
And this is also Delphi compatible.
Regards,
Sven
More information about the Lazarus
mailing list