From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.224.96.136 with SMTP id h8mr1609110qan.8.1380050015931; Tue, 24 Sep 2013 12:13:35 -0700 (PDT) X-Received: by 10.182.28.100 with SMTP id a4mr103217obh.28.1380050015898; Tue, 24 Sep 2013 12:13:35 -0700 (PDT) Path: border1.nntp.dca3.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!news.glorb.com!d5no1778709qap.0!news-out.google.com!9ni111qaf.0!nntp.google.com!d5no1778708qap.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 24 Sep 2013 12:13:35 -0700 (PDT) In-Reply-To: <58149dd9-990d-415c-a121-bc7a1a69473c@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=93.37.243.76; posting-account=9fwclgkAAAD6oQ5usUYhee1l39geVY99 NNTP-Posting-Host: 93.37.243.76 References: <58149dd9-990d-415c-a121-bc7a1a69473c@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Accessibility Levels and Library-Level Units From: mockturtle Injection-Date: Tue, 24 Sep 2013 19:13:35 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Original-Bytes: 3999 Xref: number.nntp.dca.giganews.com comp.lang.ada:183445 Date: 2013-09-24T12:13:35-07:00 List-Id: 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 A= ccessibility_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_Leve= l_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: >=20 >=20 >=20 > 1. package Accessibility_Level_Def is >=20 > 2. pragma Pure; >=20 > 3. type Proc_Type is access procedure (An_Str : String); >=20 > 4. end Accessibility_Level_Def; >=20 >=20 >=20 > I have a main program which references it (and another package): >=20 >=20 >=20 > 1. with Ada.Text_IO; use Ada.Text_IO; >=20 > 2. with Accessibility_Level_Def; use Accessibility_Level_D= ef; >=20 > 3. with Accessibility_Level_Implementation; use Accessibility_Level_I= mplementation; >=20 > 4. procedure Accessibility_Level_Test is >=20 > 5. procedure Test (Text : String); >=20 > 6. procedure Test (Text : String) is >=20 > 7. begin >=20 > 8. Put_Line ("in Test"); >=20 > 9. end Test; >=20 > 10.=20 >=20 > 11. The_Proc : Proc_Type; >=20 > 12. begin >=20 > 13. The_Proc :=3D Test'Access; >=20 > 14. Sub (Proc =3D> The_Proc); >=20 > 15. end Accessibility_Level_Test; >=20 >=20 >=20 > Gnat 2012 (on Ubuntu) gives the error on line 13: >=20 >=20 >=20 > "Subprogram must not be deeper than access type." >=20 >=20 >=20 > I thought I understood accessibility levels, at least, I understood the e= xamples I have found. Yet, this example appears to not have the same issue= s: >=20 >=20 >=20 > 1) All the units -- packages and procedure -- are at library level. >=20 > 2) The procedure is statically defined and is not going to be=20 >=20 > deallocated until the program exits. >=20 >=20 >=20 > This is very frustrating and would seem to preclude the definition of a p= rocedural access type in a separate definitions package. The Implementatio= n package (defining procedure Sub but not shown) compiles nicely, btw. >=20 >=20 >=20 > Is this a problem with Gnat? If not, how can I do what I want to do? Th= e attribute Unchecked_Access is not available for subprogram access types. >=20 >=20 >=20 > -- Eryndlia (KK1T)