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=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT autolearn=no autolearn_force=no version=3.4.4 Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!philabs!cmcl2!harvard!husc6!panda!genrad!decvax!decwrl!pyramid!hplabs!sdcrdcf!sdcsvax!noscvax!broman From: broman@noscvax.UUCP Newsgroups: net.lang.ada Subject: Re: ForTran-Ada + flamette + question Message-ID: <492@noscvax.UUCP> Date: Wed, 21-May-86 12:40:37 EDT Article-I.D.: noscvax.492 Posted: Wed May 21 12:40:37 1986 Date-Received: Sat, 24-May-86 05:01:44 EDT References: <8605210805.AA20308@ucbvax.Berkeley.EDU> Organization: Naval Ocean Systems Center, San Diego Summary: map an enumeration to the procedures with a case statement. List-Id: In article <8605210805.AA20308@ucbvax.Berkeley.EDU>, larry@JPL-VLSI.ARPA writes: > The biggest difference is that you can use subprogram names as parameters > to subprograms in ForTran and you can't in Ada. This is causing me major > problems in porting EMACS (written in C) to Ada. > Anyone have an idea how to do run-time binding of keys to commands in Ada? Unfortunately, Ada seems to be designed to make that as hard as possible. The Steelman requirement 5D says: "Procedures, functions, types, labels, exception situations, and statements shall not be assignable to variables, be computable as values of expressions, or be usable as nongeneric parameters to procedures or functions." This is a major lossage, in my view, compared to the reasonable design in (e.g.) Modula-2 for defining procedure pointers. The only way I can see to simulate procedure pointers is to define an enumeration type with elements corresponding to the procedures that may be pointed to (as well as NULL) and write a procedure with a big CASE statement which dispatches to the procedure corresponding to the enumeration-value you supply as a parameter (or complains about calling NULL). Yeah, I know, yuk. Vincent Broman, code 632, Naval Ocean Systems Center, San Diego, CA 92152, USA Phone: +1 619 225 2365 {seismo,caip,ihnp4,ucbvax}!\\\\\\\ Arpa: broman@bugs.nosc.mil Uucp: {floyd,moss,bang,hp-sdd,sdcsvax}!noscvax!broman