comp.lang.ada
 help / color / mirror / Atom feed
* little precision about anonymous access types
@ 2018-03-19  0:37 Mehdi Saada
  2018-03-19  1:08 ` Mehdi Saada
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Mehdi Saada @ 2018-03-19  0:37 UTC (permalink / 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.


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2018-05-18  7:44 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2018-05-15 21:44           ` Randy Brukardt

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