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 16:41:34 GMT From: cis.ohio-state.edu!zaphod.mps.ohio-state.edu!howland.reston.ans.net!ira.u ka.de!math.fu-berlin.de!cs.tu-berlin.de!mailgzrz.TU-Berlin.DE!news.netmbx.de!Ge rmany.EU.net!mcsun!uknet!pipex!zaphod.crihan.fr!univ-lyon1.fr!scsing.switch.ch! sicsun!disuns2.epfl.ch!di.epfl.c, Subject: Re: Passing procedures as parameters to procedures. Message-ID: <1993May4.183607@di.epfl.ch> List-Id: In article <1993May4.094549.13420@sei.cmu.edu>, firth@sei.cmu.edu (Robert Firth ) writes: : [...] 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. Use generics (for simple cases--99.99%): generic with function F (X : Float) return Float; function Integrate (Lower_Bound, Upper_Bound : Float) return Float; function Sin (X : Float) return Float; function Integrate_Sin is -- Sin many times :-) new Integrate (F => Sin); I am constantly amazed that the power of generics is so widely underestimated. I've even heard that some people prefer to use the C preprocessor to _simulate_ instantiations instead of using Ada's genericity. Please say I'm wrong. -- Magnus Kempe "No nation was ever drunk when wine was cheap." magnus@lglsun.epfl.ch -- Thomas Jefferson