Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!wuarchive!psuvax1!hsdndev!cmcl2!adm!news From: CDCKAB%EMUVM1.BITNET@cunyvm.cuny.edu ( Karl Brendel) Newsgroups: comp.lang.pascal Subject: Re: Pointers to procedures Message-ID: <26523@adm.brl.mil> Date: 10 Apr 91 18:20:56 GMT Sender: news@adm.brl.mil Lines: 32 In article , bg11+@andrew.cmu.edu (Brian E. Gallew) wrote: >I don't know much about Procedure Pointers in PASCAL, but I can see >one way in which this becomes truly elegant. > >Define an array of Procedure Pointers. This, in conjuction with a >numerical or key-letter input reduces to a mapping function (for >key-letters) and a single call ProcPtrVar[Choice]; True, but the original question involved accepting a character _string_ naming the procedure (although e-mail has revealed that what the poster really _wants_ is a menu pick). Also this solution doesn't allow for passing parameters to procedures unless they all take the same sequence of parameters (same quantity, order and type). (E-mail has also revealed that the poster does want varying sequences of parameters.) (Of course, an input character string can be compared to an array of character strings to determine an index to an array of pointers. I think this has previously been proposed in this discussion. IMO, that is only slightly more elegant than IFs, and again does not allow varying sequences of parameters.) Cheers-- --Karl +--------------------------------------------------------------------+ | Karl Brendel Centers for Disease Control | | Internet: CDCKAB@EMUVM1.BITNET Epidemiology Program Office | | Bitnet: CDCKAB@EMUVM1 Atlanta GA 30093 USA | | Home of Epi Info 5.0 | +--------------------------------------------------------------------+