comp.lang.ada
 help / color / mirror / Atom feed
From: broman@noscvax.UUCP
Subject: Re: ForTran-Ada + flamette + question
Date: Wed, 21-May-86 12:40:37 EDT	[thread overview]
Date: Wed May 21 12:40:37 1986
Message-ID: <492@noscvax.UUCP> (raw)
In-Reply-To: 8605210805.AA20308@ucbvax.Berkeley.EDU

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

  parent reply	other threads:[~1986-05-21 16:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1986-05-21  6:06 ForTran-Ada + flamette + question larry
1986-05-21 15:41 ` Mark Biggar
1986-05-21 16:40 ` broman [this message]
1986-05-27 13:07   ` ForTran-Ada ... (really procedure variables) Vic Churchill
1986-05-28 19:30 ` ForTran-Ada + flamette + question David Lamb
     [not found] <175155@QZCOM>
1986-05-22  1:00 ` Jan_Michael_Rynning
  -- strict thread matches above, loose matches on Subject: below --
1986-05-28 15:54 richw
1986-05-30 12:46 ` Russ Holden
1986-05-28 16:56 richw
1986-05-30 16:28 ` Vincent P. Broman
1986-06-02 16:28   ` Jonathan P. Biggar
1986-06-03  5:11     ` Barry Margolin
1986-06-03 12:39     ` Russ Holden
1986-06-04 23:39   ` Bryce Bardin
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox