comp.lang.ada
 help / color / mirror / Atom feed
From: g_harrison@vger.nsu.edu ((George C. Harrison) Norfolk State University)
Subject: Re: procedural variables
Date: 12 Feb 91 23:04:44 GMT	[thread overview]
Message-ID: <633.27b83c4c@vger.nsu.edu> (raw)
In-Reply-To: 662@esosun.UUCP

In article <662@esosun.UUCP>, howard@esosun.css.gov (Howard Turner) writes:
> 	jduarte@ternes.ICS.UCI.EDU (J o s e D u a r t e ! ! !) writes:
> 
> 		Since Ada does not provide for procedural variables, how
> 	do you/your associates handle the need for having a procedure or
> 	a task perform different duties depending on run-time circumstances?
> 
> Two methods come to mind immediately.  Since I am involved developing
> an Ada/Xt and Ada/widget_set  I've had to solve this "problem".
> 
> The two methods are 
> 
> 1) use tasks.  The prototype code for this is included at the end 
>    of this posting.  This code has been compiled linked and run
>    under several different hardware/compiler combinations and has
>    always run correctly.
> 
> 2) Call it from C.
> [etc.]

I am of the impression that one reason procedure parameters were NOT placed
into the Ada standard is that generic subroutines can do the same trick:

Pasqual:

procedure DEMO ( procedure F ( X, Y : INTEGER; var R : REAL ); S : CHAR);

might be

Ada:

generic
  with procedure F ( X, Y : in INTEGER; R : in out FLOAT );
procedure DEMO ( S : in CHARACTER );
~~~~~~~~~~~~~~~::::::::::::
procedure DEMO ( S : in CHARACTER ) is
.....
end DEMO;
~~~~~~~~~~~~~~~::::::::::::
with DEMO;
procedure MAIN is
.................
  procedure QQQ ( LEG1, LEG2 : in INTEGER; REALSTUFF : in out FLOAT) is
  ....
  end QQQ;

  procedure MYDEMO is new procedure DEMO ( F => QQQ);
    use MYDEMO;

......
end MAIN;

-- George C. Harrison -------------- || -- My opinions and observations --
---|| Professor of Computer Science  || -- Only. -------------------------
---|| Norfolk State University, ---- || ----------- Pray for Peace -------
---|| 2401 Corprew Avenue, Norfolk, Virginia 23504 -----------------------
---|| INTERNET:  g_harrison@vger.nsu.edu ---------------------------------

  parent reply	other threads:[~1991-02-12 23:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1991-02-11 18:04 procedural variables J o s e D u a r t e ! ! !
1991-02-11 21:45 ` Howard Turner
1991-02-12 12:32   ` Matthias Ulrich Neeracher
1991-02-15 18:32     ` Charles H. Sampson
1991-02-16 13:12       ` madmats
1991-02-19 20:33         ` stephen edwards
1991-02-20 21:02           ` Jim Showalter
1991-02-18  0:28       ` Jim Showalter
1991-02-12 23:04   ` (George C. Harrison) Norfolk State University [this message]
  -- strict thread matches above, loose matches on Subject: below --
1991-02-14 19:08 stt
1991-02-24 21:18 Erland Sommarskog
replies disabled

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