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: a07f3367d7,65b902127ca8a604 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!u-picardie.fr!news.ecp.fr!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Issue with GNAT GPL 2009 and GtkAda Date: Fri, 26 Jun 2009 16:51:39 -0500 Organization: Jacob Sparre Andersen Message-ID: References: <4A414EBB.8060204@free.fr> <1avd65rn49abv$.krcxo2gdzb16$.dlg@40tude.net> <4a43c9ce$0$420$426a74cc@news.free.fr> <4a44ae4e$0$6295$4f793bc4@news.tdc.fi> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1246053141 16229 69.95.181.76 (26 Jun 2009 21:52:21 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Fri, 26 Jun 2009 21:52:21 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5512 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-RFC2646: Format=Flowed; Response Xref: g2news2.google.com comp.lang.ada:6655 Date: 2009-06-26T16:51:39-05:00 List-Id: >Niklas Holsti" wrote in message >news:4a44ae4e$0$6295$4f793bc4@news.tdc.fi... > > Damien Carbonne writes: > >> > >> type Listener is interface; > >> procedure Process (L : in out Listener) is abstract; > ... > >> type Base is tagged null record; > ... > >> type Derived is new Base and Listener with null record; > >> overriding procedure Process (D : in out Derived); > >> > > Stephen Leake wrote: >> The problem is clear here. >> >> "D : in out Derived" is allowed to create a copy of the actual >> parameter. > > Huh? Do you mean that this "D" parameter may be passed by copy? But > "Derived" is a tagged type, and tagged types are passed by reference, not > by copy. Or so I thought. I think he means that the accessibility level of a parameter is that of a local object, as it *might* have been passed by copy. (There are no special rules here for tagged types.) So when you pass it to an access parameter, you get local accessibility and any attempt to use it with a named access type is going to fail a run-time accessibility check (raising Program_Error). The only way that we could have done better would be to pass an accessibility level with every tagged parameter. That seems like way too much overhead. You can use 'Unchecked_Access to get around the accessibility check, of course, but if it would have failed, there is a chance that you will have done something that would actually create a dangling pointer. The aliased parameters that we're looking to add to Ada will mitigate this problem somewhat, but only a little. The addition of "in out" parameters to functions will mitigate it some more (eliminating many uses of access parameters). We've pretty much given up on fixing the accessibility model in favor of changes that allow using fewer access types. We would have liked to fix it, but compatibility and overhead concerns make it impossible. Randy.