comp.lang.ada
 help / color / mirror / Atom feed
From: christoph.grein@eurocopter.com
To: comp.lang.ada@ada-france.org
Subject: Re: Procedural Types
Date: Wed, 15 Oct 2003 09:02:44 +0200 (MET DST)
Date: 2003-10-15T09:02:44+02:00	[thread overview]
Message-ID: <mailman.87.1066202199.25614.comp.lang.ada@ada-france.org> (raw)

> Is it possible to define procedural types in ADA95 ? CLearly is it
> possible to define procedure type and implement various procedures
> with the same type ?

Strictly speaking, there are no subprogram types (procedure and function types).

Less strictly speaking, a subprogram type is defined by its parameter and return 
profile. So any subprogram matching the profile can e.g. be used as an actual 
parameter in a generic instantiation.

There are also subprogram access types (pointers). Any subprogram matching the 
pointer profile can be assigned to such a pointer (if the access level is 
correct).

type P_Pointer is access procedure;

procedure Proc;

P: P_Pointer := Proc'Access;

P.all;  -- call Proc

type F_Pointer is access function (X: A_Type) return Another_Type;

function Func (X: A_Type) return Another_Type;

F: F_Pointer := Func'Access;

V := F.all (X);  -- call Func
V := F (X);      -- call Func (implecit dereference)



             reply	other threads:[~2003-10-15  7:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-15  7:02 christoph.grein [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-10-15  6:59 Procedural Types Umut DURAK
2003-10-15  7:43 ` Dmitry A. Kazakov
replies disabled

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