From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 4 May 93 13:45:49 GMT From: cis.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!howland. reston.ans.net!europa.eng.gtefsd.com!fs7.ece.cmu.edu!news.sei.cmu.edu!firth@ucb vax.Berkeley.EDU (Robert Firth) Subject: Re: Passing procedures as parameters to procedures. Message-ID: <1993May4.094549.13420@sei.cmu.edu> List-Id: In article <1993May3.190746.1043@ee.ubc.ca> luisl@ee.ubc.ca (luis linares-rojas ) writes: >Before commiting myself to any long term commitment with the Ada language, >I've been revising its capabilities. There is something that I have not >found so far: how to pass a procedure (or a function) as a parameter to anothe r >procedure (or function). Or, in the same spirit, how to create an array of >procedures. The question is: is there a way of doing this in Ada, and (if so) >how? I'd appreciate any help. Alas, Ada has no good way to do this, and I doubt you'd want to maintain code that used any of several bad ways. I assume for your first problem you're trying to replicate something like the Algol-60 real procedure Integrate ( real procedure F; real lwb, upb ); and put it in a library package somewhere. You can't do it. The second problem is typified by a finite state machine: you have a two-dimensional array indexed on [state, input], and each component is a procedure Action that returns the new state. And you probably want to change the actions on the fly. Nope, you can't do that either. Sorry; as I see it, either use another language or hold your breath until Ada93.