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_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,565ee1c43df7874f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-09-11 00:43:39 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!newsfeed.media.kyoto-u.ac.jp!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.fjserv.net!news.teledanmark.no!uninett.no!dax.net!juliett.dax.net!not-for-mail Newsgroups: comp.lang.ada Subject: Re: array of operations References: <3D7E0EB1.2070708@attbi.com> From: Ole-Hjalmar Kristensen Message-ID: <7vfzwh9dkl.fsf@vlinux.voxelvision.no> User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 11 Sep 2002 07:43:07 GMT NNTP-Posting-Host: 193.216.12.150 X-Complaints-To: abuse@tele2.no X-Trace: juliett.dax.net 1031730187 193.216.12.150 (Wed, 11 Sep 2002 09:43:07 MET DST) NNTP-Posting-Date: Wed, 11 Sep 2002 09:43:07 MET DST Organization: Tele2 Norway AS Public Access Xref: archiver1.google.com comp.lang.ada:28816 Date: 2002-09-11T07:43:07+00:00 List-Id: "Ehud Lamm" writes: > "Mark Biggar" wrote in message > news:3D7E0EB1.2070708@attbi.com... > > marco wrote: > > > Do you know if there is some way of bulding up arrays of functions > and/or > > > procedures?... > > > > Sure, Ada allows for access types to functions and procedures so you > > construct an array of those. > > Notice that all the procedures must have the same parameter profile. There > are cases where this isn't what you want. > There are also nesting issues (you can't have a top level array linking to > nested subroutines) [Note to language lawyers: The last sentence was not > meant to be a formal definition...] > > So in many cases you may decide (after thinking about "access procedure" and > "access function") to use a dispatching routine that is invoked with an > "opcode" (operation code) and calls the appropriate routine. > > Ehud Or a pointer to an object and let the dispatching mechanism implement the function pointer behind the scenes.