comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Issue with GNAT GPL 2009 and GtkAda
Date: Fri, 26 Jun 2009 16:51:39 -0500
Date: 2009-06-26T16:51:39-05:00	[thread overview]
Message-ID: <h23fuk$fr5$1@munin.nbi.dk> (raw)
In-Reply-To: 4a44ae4e$0$6295$4f793bc4@news.tdc.fi

>Niklas Holsti" <niklas.holsti@tidorum.invalid> wrote in message 
>news:4a44ae4e$0$6295$4f793bc4@news.tdc.fi...
> > Damien Carbonne <damien.carbonne@free.fr> 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.





  parent reply	other threads:[~2009-06-26 21:51 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-23 21:52 Issue with GNAT GPL 2009 and GtkAda Damien Carbonne
2009-06-24  7:40 ` Dmitry A. Kazakov
2009-06-24 10:15 ` Stephen Leake
2009-06-25  9:06   ` Stephen Leake
2009-06-25  9:39     ` Dmitry A. Kazakov
2009-06-25 19:02       ` Damien Carbonne
2009-06-26  9:31         ` Stephen Leake
2009-06-26 11:18           ` Niklas Holsti
2009-06-26 16:29             ` Damien Carbonne
2009-06-26 17:28               ` Dmitry A. Kazakov
2009-06-26 19:27                 ` Damien Carbonne
2009-06-26 19:50                   ` Dmitry A. Kazakov
2009-06-26 21:51             ` Randy Brukardt [this message]
2009-06-27 11:11               ` Stephen Leake
2009-06-27 17:04                 ` Robert A Duff
2009-06-30 11:11                   ` Stephen Leake
2009-06-30 18:10                     ` Robert A Duff
2009-06-29 22:11                 ` Randy Brukardt
2009-06-30 11:13                   ` Stephen Leake
2009-06-30 15:26                     ` Adam Beneschan
2009-06-30 15:59               ` Adam Beneschan
2009-06-30 23:11                 ` Randy Brukardt
2009-06-27  9:56             ` Stephen Leake
2009-06-26 21:03           ` Damien Carbonne
2009-06-27 11:21             ` Stephen Leake
2009-06-27 12:25               ` Damien Carbonne
2009-06-27 12:35                 ` Damien Carbonne
2009-06-29 22:15                   ` Randy Brukardt
2009-07-01 19:22                     ` Damien Carbonne
2009-06-30  0:48             ` Adam Beneschan
2009-06-30 11:18               ` Stephen Leake
2009-06-25 20:49       ` Randy Brukardt
2009-06-26  7:20         ` Dmitry A. Kazakov
2009-06-26  8:17           ` Georg Bauhaus
2009-06-26  8:52             ` Dmitry A. Kazakov
2009-06-26 21:38               ` Randy Brukardt
2009-06-27  7:47                 ` Dmitry A. Kazakov
2009-06-29 21:59                   ` Randy Brukardt
2009-06-30  8:31                     ` Dmitry A. Kazakov
2009-06-26 21:31           ` Randy Brukardt
2009-06-27  7:53             ` Dmitry A. Kazakov
2009-06-26  8:39       ` Alex R. Mosteo
2009-06-26  9:07         ` Dmitry A. Kazakov
2009-06-27  9:53           ` Stephen Leake
2009-06-26 21:40         ` Randy Brukardt
2009-06-29 10:04           ` Alex R. Mosteo
2009-06-26  9:02       ` Stephen Leake
2009-06-26  9:14         ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox