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-10 19:17:30 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: dennison@telepath.com (Ted Dennison) Newsgroups: comp.lang.ada Subject: Re: array of operations Date: 10 Sep 2002 19:17:29 -0700 Organization: http://groups.google.com/ Message-ID: <4519e058.0209101817.3c3cfb3b@posting.google.com> References: NNTP-Posting-Host: 65.115.221.98 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1031710650 26725 127.0.0.1 (11 Sep 2002 02:17:30 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 11 Sep 2002 02:17:30 GMT Xref: archiver1.google.com comp.lang.ada:28811 Date: 2002-09-11T02:17:30+00:00 List-Id: "marco" wrote in message news:... > Do you know if there is some way of bulding up arrays of functions and/or > procedures?... Yes, there are ways. However, the usual answer here to a "how do I do this very C-ish thing in Ada?" question is "Why do you want to?" So...Why do you want to? :-) If it is to interface to a C routine that requires that exact type, then OK, that's a legitimate reason. However, if you just want an array that can be populated by clients where the client gets to specify a behavior, there are other better ways of doing it. For instance, have you considered using tagged types and runtime polymorphisim? You make an array of pointers to some base tagged type's "'Class", which has a primitive routine for you to call (let's call it "Do_It"). Then each client can derive their own version of that tagged type and override "Do_It" with their own operation. This is much more powerful than meer function pointers, is generally considered better OO design, and is better supported by the language.