comp.lang.ada
 help / color / mirror / Atom feed
From: mockturtle <framefritti@gmail.com>
Subject: Re: Accessibility Levels and Library-Level Units
Date: Tue, 24 Sep 2013 12:13:35 -0700 (PDT)
Date: 2013-09-24T12:13:35-07:00	[thread overview]
Message-ID: <e2a5be26-0dcf-4ef1-8487-87873ab87062@googlegroups.com> (raw)
In-Reply-To: <58149dd9-990d-415c-a121-bc7a1a69473c@googlegroups.com>

This came to my mind just after clicking "Post"...

About the fact that   Accessibility_Level_Test is the "main:" I think (but I never tested it) that you could have two legal Ada codes, one that uses Accessibility_Level_Test as "main" and the other that uses it as a "normal" procedure.  (For example, if you use GNAT, the fact that a procedure is a "main" it is written in the project file, not in the Ada source.)  Maybe it is because of this that you cannot exploit the fact that Accessibility_Level_Test is the main.

Riccardo


On Tuesday, September 24, 2013 8:36:43 PM UTC+2, Eryndlia Mavourneen wrote:
> I have a package that defines a single procedure access type:
> 
> 
> 
>    1. package Accessibility_Level_Def is
> 
>    2.   pragma Pure;
> 
>    3.   type Proc_Type is access procedure (An_Str : String);
> 
>    4. end Accessibility_Level_Def;
> 
> 
> 
> I have a main program which references it (and another package):
> 
> 
> 
>     1. with Ada.Text_IO;                        use Ada.Text_IO;
> 
>     2. with Accessibility_Level_Def;            use Accessibility_Level_Def;
> 
>     3. with Accessibility_Level_Implementation; use Accessibility_Level_Implementation;
> 
>     4. procedure Accessibility_Level_Test is
> 
>     5.    procedure Test (Text : String);
> 
>     6.    procedure Test (Text : String) is
> 
>     7.    begin
> 
>     8.       Put_Line ("in Test");
> 
>     9.    end Test;
> 
>    10. 
> 
>    11.    The_Proc : Proc_Type;
> 
>    12. begin
> 
>    13.    The_Proc := Test'Access;
> 
>    14.    Sub (Proc => The_Proc);
> 
>    15. end Accessibility_Level_Test;
> 
> 
> 
> Gnat 2012 (on Ubuntu) gives the error on line 13:
> 
> 
> 
>    "Subprogram must not be deeper than access type."
> 
> 
> 
> I thought I understood accessibility levels, at least, I understood the examples I have found.  Yet, this example appears to not have the same issues:
> 
> 
> 
> 1) All the units -- packages and procedure -- are at library level.
> 
> 2) The procedure is statically defined and is not going to be 
> 
>    deallocated until the program exits.
> 
> 
> 
> This is very frustrating and would seem to preclude the definition of a procedural access type in a separate definitions package.  The Implementation package (defining procedure Sub but not shown) compiles nicely, btw.
> 
> 
> 
> Is this a problem with Gnat?  If not, how can I do what I want to do?  The attribute Unchecked_Access is not available for subprogram access types.
> 
> 
> 
> -- Eryndlia (KK1T)


  parent reply	other threads:[~2013-09-24 19:13 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-24 18:36 Accessibility Levels and Library-Level Units Eryndlia Mavourneen
2013-09-24 18:54 ` Eryndlia Mavourneen
2013-09-24 19:23   ` Adam Beneschan
2013-09-24 19:06 ` mockturtle
2013-09-25  7:46   ` Dmitry A. Kazakov
2013-09-24 19:13 ` mockturtle [this message]
2013-09-24 19:23   ` Eryndlia Mavourneen
2013-09-24 19:27   ` Adam Beneschan
2013-09-24 20:02     ` J-P. Rosen
2013-09-24 20:17       ` Eryndlia Mavourneen
2013-09-24 20:32       ` Adam Beneschan
2013-09-24 19:31 ` Jeffrey Carter
2013-09-24 19:43   ` Eryndlia Mavourneen
2013-09-24 19:59     ` Adam Beneschan
2013-09-24 20:50     ` Robert A Duff
2013-09-25 14:40       ` Eryndlia Mavourneen
2013-09-25 21:34         ` Robert A Duff
2013-09-26 12:46           ` Eryndlia Mavourneen
2013-09-29 21:36             ` Stephen Leake
replies disabled

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