comp.lang.ada
 help / color / mirror / Atom feed
From: Mehdi Saada <00120260a@gmail.com>
Subject: little precision about anonymous access types
Date: Sun, 18 Mar 2018 17:37:41 -0700 (PDT)
Date: 2018-03-18T17:37:41-07:00	[thread overview]
Message-ID: <edf7b96a-f340-408c-994f-d5aa73b9f2db@googlegroups.com> (raw)

I have a little question about (anonymous) access types:
I can do that:
procedure main is
   type A is access INTEGER;
   A_O : A := new INTEGER'(54);
begin
   declare
      B: access INTEGER;
   begin
      B := A_O;
   end;
end main;

But I can't do that, without being told A must be a general access type:
procedure main is
   type A is access INTEGER;
   A_O : A;
begin
   declare
      B: access INTEGER := new INTEGER'(7);
   begin
      A_O := A(B);
   end;
end main;
But I'm doing A_O := some_variable_of_the_stack'Access,
I'm affecting A_O to another access object. Not taking an 'Access out of it.

At first, I wondered what were the scope of declaration of anonymous access objects like B.
Is: "B: access INTEGER := new INTEGER'(7);"
STRICTLY equivalent to
"type B_ANONYMOUS_TYPE is access INTEGER;
B: B_ANONYMOUS_OBJECT;"
chiefly regards to what and when I can affect things to of from anonymous access objects.


             reply	other threads:[~2018-03-19  0:37 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-19  0:37 Mehdi Saada [this message]
2018-03-19  1:08 ` little precision about anonymous access types 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
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