comp.lang.ada
 help / color / mirror / Atom feed
From: "Didier DOUSSAUD" <d_doussaud@csi.com>
Subject: Language question : function'Access / function'unchecked_Access
Date: 1998/11/24
Date: 1998-11-24T00:00:00+00:00	[thread overview]
Message-ID: <ek1BDX5F#GA.291@nih2naac.prod2.compuserve.com> (raw)

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;













             reply	other threads:[~1998-11-24  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-11-24  0:00 Didier DOUSSAUD [this message]
1998-11-24  0:00 ` Language question : function'Access / function'unchecked_Access Matthew Heaney
1998-11-25  0:00 ` Pascal Obry
replies disabled

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