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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,65b902127ca8a604 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!feeder.news-service.com!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Issue with GNAT GPL 2009 and GtkAda Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <4A414EBB.8060204@free.fr> <1avd65rn49abv$.krcxo2gdzb16$.dlg@40tude.net> Date: Fri, 26 Jun 2009 09:20:56 +0200 Message-ID: <10ym4hltpwd4n$.1hcayfi4xidg3.dlg@40tude.net> NNTP-Posting-Date: 26 Jun 2009 09:20:57 CEST NNTP-Posting-Host: 04a3e301.newsspool3.arcor-online.net X-Trace: DXC=8kgB8e:9C6aTXg@ X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:6625 Date: 2009-06-26T09:20:57+02:00 List-Id: On Thu, 25 Jun 2009 15:49:58 -0500, Randy Brukardt wrote: > "Dmitry A. Kazakov" wrote in message > news:1avd65rn49abv$.krcxo2gdzb16$.dlg@40tude.net... > ... >> Yes, but that is not necessarily a compiler bug. It is quite simple to >> create a serious problem to oneself: >> >> declare >> Ptr : access T := new T; >> begin > > Allocators of anonymous access types are almost never what you want. This is > so true, in fact, that we have proposed a Restriction for this > "No_Anonymous_Allocators", which I recommend is part of every program. (Of > course, that will have to wait until compilers implement it; it wasn't > formally proposed until 3 weeks ago, but it was accepted at the Brest > meeting and thus will appear in the next working draft). The only purpose of Ptr : access T := new T; I can guess is allocation of a large scoped object on the heap. It would be better if there were a syntax for that, which does not involve access types. Object : new T; or Object : T'Pool; or Object : T; for Object'Storage_Pool use System.Default_Storage_Pool; etc. Access types are much overused in Ada in order to overcome language problems unrelated to access types. Just to remember: access discriminants (MI for poor), the Rosen trick (in out parameters of a function), return by access (a patch where in-place results should have been) and so on. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de