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=2.1 required=5.0 tests=BAYES_00,INVALID_MSGID,
MSGID_RANDY,PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no
version=3.4.4
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 103376,6d47794b76bd8d3f
X-Google-Attributes: gid103376,public
From: "Pascal Obry"
Subject: Re: Language question : function'Access / function'unchecked_Access
Date: 1998/11/25
Message-ID: <73gka5$fco$1@cf01.edf.fr>#1/1
X-Deja-AN: 415476154
References:
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Organization: EDF
Newsgroups: comp.lang.ada
Date: 1998-11-25T00:00:00+00:00
List-Id:
Didier,
You can't do that, the compiler is right !
There is many solutions. Two of them have been described by Matthew Heaney.
The other solution is to put you Match function in a separate package. This
way you don't
have the problem of "Accessiblility Level".
Pascal.
Didier DOUSSAUD a �crit dans le message ...
>I write a list package and need a Seach function that return the "Index" of
>the object that match some condition.
>
>(the condition is coded in a function that have for parameter the item of
>the list and return the boolean result of the test )
>
>Impossible to call the Search function ????
>
>Look the following sample may be more explicit than my poor english...
>
>Thanks
>Didier
>d_doussaud@csi.com
>
>--------------------------------------------------------------------
>package P_List is
> type Item is null record;
> type List is null record;
> type Index is null record;
>
> type Search_Function is access function ( I : Item ) return Boolean;
>
> function Search( L : List; Funct : Search_Function ) return Index;
>end P_List;
>-----------------------------------------------------------------------
>with P_List; use P_List;
>procedure Test_Callback is
> L : List;
> I : Index;
> function Match( I : Item ) return Boolean is
> begin
> return True;
> end;
>begin
>
> -- this line :
> I := Search( L, Match );
> -- generate the ERROR :
> -- The Accessibility Level of The Subprogram Denoted By The The Prefix
> -- Shall not Be Statically Deeper Than That of The Expected type
> -- I can understand this
>
> -- but this line :
> I := Search( L, Match'Unchecked_Access );
> -- generate the ERROR :
> -- The prefix of Unchecked_Access, which is function name, has no
> -- interpretation as A Parameterless function Call
> -- ????
>
> -- is it possible to do what I want in ADA ?
>end;
--|------------------------------------------------------------
--| Pascal Obry Team-Ada Member |
--| |
--| EDF-DER-IPN-SID- T T I |
--| Intranet: http://cln46gb |
--| Bureau N-023 e-mail: pascal.obry@edfgdf.fr |
--| 1 Av G�n�ral de Gaulle voice : +33-1-47.65.50.91 |
--| 92141 Clamart CEDEX fax : +33-1-47.65.50.07 |
--| FRANCE |
--|------------------------------------------------------------
--|
--| http://ourworld.compuserve.com/homepages/pascal_obry
--|
--| "The best way to travel is by means of imagination"