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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,5af5c381381ac5a7 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!feeder.news-service.com!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!gegeweb.org!news.ecp.fr!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Ada requires too much typing! Date: Thu, 10 Jun 2010 17:17:11 -0500 Organization: Jacob Sparre Andersen Message-ID: References: <03f84a0a-e070-43a9-9b68-920345f64f94@r27g2000yqb.googlegroups.com> <1c704c1e-1b2e-427f-ae0e-3b2a0f976c7c@y4g2000yqy.googlegroups.com> <10855f68-76a1-4600-ba65-464dab6c6274@w12g2000yqj.googlegroups.com> <7cb03fe5-a65c-4f0b-bd9d-a071b905aad1@y11g2000yqm.googlegroups.com> <4c10baa2$0$6974$9b4e6d93@newsspool4.arcor-online.net> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1276208234 22529 69.95.181.76 (10 Jun 2010 22:17:14 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Thu, 10 Jun 2010 22:17:14 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5843 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-RFC2646: Format=Flowed; Original Xref: g2news2.google.com comp.lang.ada:12589 Date: 2010-06-10T17:17:11-05:00 List-Id: "Georg Bauhaus" wrote in message news:4c10baa2$0$6974$9b4e6d93@newsspool4.arcor-online.net... > On 10.06.10 10:57, Vadim Godunko wrote: >> On Jun 10, 11:20 am, AdaMagica wrote: >>> On 10 Jun., 08:34, Vadim Godunko wrote: >>> >>>> I want to known more about how to use OOP in Ada without access types! >>> >>> type Element is tagged ... >>> subtype Any_Element is Element'Class; >>> >>> procedure Show (E: Element); >>> >> Thank you for example, this is example of dispatching but not use of >> Ada in heavy OOP style of programming. :-) > > Will it, in theory, be possible to write a Qt-like library > in Ada such that client programs declare variables like > > W : Some_Window'Class := Some_Lib_Pack.Make (Typ => Some_Id); > > That is, programs do not use access Some_Window'Class? We could have done this in Claw, but we found little need for "generic windows". At some point, you have to declare the specific window object that you need, and at that point you might as well just declare an object of that type. Claw allows window objects to be assigned, so you could definitely do something like: declare My_Window : Claw.Basic_Window.Window; begin Global_Window := Root_Window_Type'Class(My_Window); end; Unfortunately, Ada doesn't allow the changing of the tags of declared classwide objects. (This is a language bug in my view, but hardly anyone elses.) So you have to use an Ada 2012 holder container: declare My_Window : Claw.Basic_Window.Window; begin Global_Window.Replace_Element (Root_Window_Type'Class(My_Window)); end; where Global_Window is defined as: package Global_Holder is new Ada.Containers.Indefinite_Holder (Claw.Root_Window_Type'Class); Global_Window : Global_Holder; Randy.