comp.lang.ada
 help / color / mirror / Atom feed
* Re: ForTran-Ada + flamette + questi
@ 1986-06-03 19:11 gore
  1986-06-07 17:19 ` Functions and external values Erland Sommarskog
  0 siblings, 1 reply; 9+ messages in thread
From: gore @ 1986-06-03 19:11 UTC (permalink / raw)



>[ Discussion about lack of pointers to procedures in Ada ]
>
>You've gotta draw the line somewhere.  I'm continually amazed how
>people complain that Ada has either too much or not enough because
>it's left out their favorite feature from language X.  Considering the
>design goals for Ada, I think they did a good (not perfect) job of
>designing a language with which you can write both efficient and
>abstract, safe programs.

Personally, my complaint is more about the incomplete orthogonality of Ada 
than about lack of specific features.  If task types (and hence pointers to
tasks) are allowed, why not allow procedure types, package types, entry types?
We should not automatically assume that addition of these automatically means
making the language bigger.  For example, if there was a way to maintain
structures of entries, there would be no need for "families of entries".

Another example:  If only 'in' parameters are allowed in functions, why allow
access to external variables from inside a function?

Jacob Gore
Northwestern Univ
Comp Sci Research Lab
ihnp4!nucsrl!gore

^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: ForTran-Ada + flamette + question
@ 1986-05-30 12:46 Russ Holden
  1986-06-20 15:36 ` ForTran-Ada + flamette + questi richw
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Russ Holden @ 1986-05-30 12:46 UTC (permalink / raw)


> 
> The following includes a suggestion for solving your problem, along
> with my own defense of the decision to omit procedure-pointers from Ada:
> 
> The first solution I can think of (and, I guess, the simplest?) would
> be to define an enumeration type, where each enumeral (is that a
> word?) corresponds to one of the functions you'd like to bind to a
> key-sequence.  Then just write a procedure that takes such an enumeral
> as an "in" parameter and then "case"s on that parameter to the
> appropriate call.
>
> Anyway, my point is that I think that one can do all that you can do in
> C in Ada by using the above enumerals-to-subprogram mapping method; I'd
> be interested if people can provide counter-examples (I realize that
> you'd have to do more if the procedures you call take different numbers
> of arguments, but then again, you'd have to be more fancy in C, too).


Rich, you are missing out on the beauty of procedure passing.  Simply put
it gives you the ability to dynamically bind actions without the invoker
of the procedure having to know about the procedure being called.  A 
couple of examples are:

1) Table-driven code - Using C all you have to do is add a procedure
   to a table.  Using the ADA enumerated-to-procedure mapping code
   modifications are involved (see below).

2) It provides the ability for higher levels of software to abstract
   procedures from lower levels such that lower levels call but do
   not "use" these procedures (in Parnas terminology).  For example,
   (and this is not hypothetical) is a DBMS which wants to perform
   qualification of records against user-specified predicates before
   retreiving them (copying them off their page essentially).  Since
   the code performing page level manipulations is generally at a much
   lower level in processing than the code which understands about
   the values in records a procedure made available to the page level
   is an appropriate mechanism.  The use of enumerated types does no
   good and there are no real good solutions that I know of in ADA
   (if anyone has any please send me mail).

   I have used procedure pointers in lots of other situations where
   a high-level wants or needs to provide a service to a lower level.
   The only requirement is that a "standard" invokation mechanism be
   defined.
-- 
Russell Holden
Computer Corporation of America
Four Cambridge Center
Cambridge, MA 02142

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~1986-08-07 13:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1986-06-03 19:11 ForTran-Ada + flamette + questi gore
1986-06-07 17:19 ` Functions and external values Erland Sommarskog
  -- strict thread matches above, loose matches on Subject: below --
1986-05-30 12:46 ForTran-Ada + flamette + question Russ Holden
1986-06-20 15:36 ` ForTran-Ada + flamette + questi richw
1986-06-22  3:00   ` Russ Holden
1986-07-10 22:26   ` friesen
1986-07-14 17:01 ` richw
1986-07-18 21:59   ` vilot
1986-07-22 12:59 ` stt
1986-08-07 13:26   ` Christopher Reedy

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