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_50,FROM_ADDR_WS, INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!lll-winken!elroy.jpl.nasa.gov!usc!wuarchive!udel!haven!uvaarpa!vger.nsu.edu!g_harrison From: g_harrison@vger.nsu.edu ((George C. Harrison) Norfolk State University) Newsgroups: comp.lang.ada Subject: Re: procedural variables Message-ID: <633.27b83c4c@vger.nsu.edu> Date: 12 Feb 91 23:04:44 GMT References: <9102110959.aa23851@PARIS.ICS.UCI.EDU> <662@esosun.UUCP> List-Id: 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 ---------------------------------