comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: little precision about anonymous access types
Date: Fri, 18 May 2018 09:44:17 +0200
Date: 2018-05-18T09:44:17+02:00	[thread overview]
Message-ID: <pdm08h$snn$1@gioia.aioe.org> (raw)
In-Reply-To: pdkrgg$n3g$1@franka.jacob-sparre.dk

On 17/05/2018 23:17, Randy Brukardt wrote:
> "Mehdi Saada" <00120260a@gmail.com> wrote in message
> news:d294e4a5-864c-4ab0-bf60-6c9a94ace651@googlegroups.com...
>> So if it was you, you would have treated subprograms with
>> access types parameters as primitives, as long as they are declared
>> in the same immediate scope ? It sounds simple, why hasn't it be
>> do that way ?
> 
> No, I wouldn't bother with dispatching on access values at all. Since Ada
> passes all tagged objects by reference, and 'Unchecked_Access is always
> allowed on tagged parameters, it's always possible to get an access to a
> tagged parameter if that is needed. There's no reason to *pass* that value -
> just pass the tagged object.

You forgot the return. Return by reference was killed and there is no 
substitute for

    function Foo return access T;

> Essentially, there's no implementation difference (ignoring the abomination
> of dynamic accessibility) between "access T" and "in out T" for a tagged
> type T.

Yes, but there must be difference if the type system were fixed to allow 
classes of non-tagged and by-value objects.

I agree that controlling access T could be made superfluous by carefully 
designed references.

I also believe that having an operation for T and not having it for 
access T and conversely is not good. I.e. if there is

    procedure Foo (X : in out T);

then that must automatically define

    procedure Foo (X : access T);

and conversely. Rules for automatic dereferencing do this in some cases.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


  parent reply	other threads:[~2018-05-18  7:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-19  0:37 little precision about anonymous access types Mehdi Saada
2018-03-19  1:08 ` Mehdi Saada
2018-03-19  1:18 ` Mehdi Saada
2018-03-19 14:51   ` AdaMagica
2018-03-19 22:40 ` Randy Brukardt
2018-03-20 17:49   ` G. B.
2018-03-20 23:56     ` Mehdi Saada
2018-03-21 22:46       ` Randy Brukardt
2018-05-15  0:20         ` Mehdi Saada
2018-05-15  0:28           ` Mehdi Saada
2018-05-15 21:48             ` Randy Brukardt
2018-05-16  8:14               ` Mehdi Saada
2018-05-16  8:23                 ` Mehdi Saada
2018-05-17 21:20                   ` Randy Brukardt
2018-05-17 21:17                 ` Randy Brukardt
2018-05-17 21:36                   ` J-P. Rosen
2018-05-18  7:44                   ` Dmitry A. Kazakov [this message]
2018-05-15 21:44           ` Randy Brukardt
replies disabled

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