From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,36a29c2860aff686 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!29g2000prb.googlegroups.com!not-for-mail From: Shark8 Newsgroups: comp.lang.ada Subject: Re: Properties Date: Fri, 3 Dec 2010 19:12:16 -0800 (PST) Organization: http://groups.google.com Message-ID: <6326ff3f-3972-4b17-be57-a7b5d3b5ffe8@29g2000prb.googlegroups.com> References: <3b84c8e7-1a51-4a7c-9646-119f1fc51478@s4g2000yql.googlegroups.com> <4pnv7nl4cdui$.1n28i7lqk4mek$.dlg@40tude.net> <1k7367gtebsgm$.18auo6u3nfg34.dlg@40tude.net> <083addb2-61f6-4a69-bb81-2e4fa640783b@e16g2000pri.googlegroups.com> <124c5qinlvj7c$.1pdr35p7hkp11.dlg@40tude.net> <75475874-cd6c-4e75-8a2f-7675ecf0864a@f20g2000vbc.googlegroups.com> <1x7ohnuflqoqs.58dfeefat1q2.dlg@40tude.net> NNTP-Posting-Host: 174.28.198.93 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1291432336 998 127.0.0.1 (4 Dec 2010 03:12:16 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 4 Dec 2010 03:12:16 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: 29g2000prb.googlegroups.com; posting-host=174.28.198.93; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12 ( .NET CLR 3.5.30729; .NET4.0E),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:16764 Date: 2010-12-03T19:12:16-08:00 List-Id: On Dec 3, 3:38=A0pm, "Dmitry A. Kazakov" wrote: > On Fri, 3 Dec 2010 11:52:22 -0800 (PST), Shark8 wrote: > > On Dec 3, 2:05 am, "Dmitry A. Kazakov" > > wrote: > >> The bottom line, interfaces must be removed from Ada. > >> Instead of that an interface must be made inheritable > >> from any concrete type. This is the same idea as with > >> abstract record, array etc types. > > > Wouldn't this be alleviated by two things: > > Allowing INTERFACE [keyword] objects to have fields (properties as > > I've described, or somesuch)? > > These are different problems: > > 1. Record interface, this is in effect what you proposed: > > =A0 =A0type Members is interface record > =A0 =A0 =A0 =A0A : Integer; -- Not a physical member only an interface "O= bject.A" > =A0 =A0end record; > > [I want other interfaces too, like array interface, access interface etc.= ] > > 2. Interface inheritance. Let you have some type: > > =A0 =A0type T is tagged ... > =A0 =A0procedure Foo (X : T); > > You have to replace it to > > =A0 =A0type Interface_of_T is interface; > =A0 =A0procedure Foo (X : Interface_T) is abstract; > > =A0 =A0type T is ... and Interface_of_T ... > =A0 =A0overriding procedure Foo (X : T); > > In order to be able to say: > > =A0 =A0type S is ... and Interface_of_T ... > =A0 =A0overriding procedure Foo (X : S); > > It is boring. Each type obviously has an interface, which must be > inheritable from. > > > Allowing objects some sort of self/this/me attribute where the result > > is a Not Null Access to its classwide-type*? (Or am I misunderstanding > > what you mean by the need for "a fat pointer transparent to all widget > > operations"?) > > I mean this: > > =A0 =A0-- Anything you can do with a widget > =A0 =A0type Widget_Interface is limited interface; > =A0 =A0procedure Draw (Object : in out Widget_Interface) is abstract; > =A0 =A0... > > =A0 =A0-- Implementation of a widget > =A0 =A0type Widget_Object is new Widget_Interface with ...; > =A0 =A0overriding procedure Draw (Object : in out Widget_Object); > > =A0 =A0type Widget_Object_Ptr is access all Widget_Object; > > =A0 =A0-- Public interface of a widget, a reference > =A0 =A0type Widget is new Ada.Finalization.Controlled and Widget_Interfac= e with > =A0 =A0record > =A0 =A0 =A0 Ptr : Widget_Object_Ptr; > =A0 =A0end record; > =A0 =A0overriding procedure Draw (Object : in out Widget); > > =A0 =A0procedure Draw (Object : in out Widget) is > =A0 =A0begin > =A0 =A0 =A0 Draw (Object.Ptr.all); > =A0 =A0end Draw; > > Widget_Object is private, publicly accessible is its fat pointer/handle > Widget. Both implement the same interface Widget_Interface. > > -- > Regards, > Dmitry A. Kazakovhttp://www.dmitry-kazakov.de Ah, I see! Delphi has the nice ability to delegate the implementation for an interface... so the analog to your type widget would be: Type {TObject is the root-object in Delphi} TWidget =3D Class( TObject, Widget_Interface ) public Object : ^Widget_Object implements Widget_Interface; end; {Class TWidget} And then all calls to objects of TWidget via Widget_Interface are automatically routed to the Object field.