From: wolff@inf.fu-berlin.de (Thomas Wolff)
Subject: Re: Q: access to subprogram
Date: 1996/07/09
Date: 1996-07-09T00:00:00+00:00 [thread overview]
Message-ID: <4rud2m$58m@fu-berlin.de> (raw)
In-Reply-To: 4re8bj$qfk@krusty.irvine.com
Adam Beneschan: >>>Q: access to subprogram
: It should be noted that the new object-oriented features of Ada 95
: should make subprogram accesses less necessary than before. Abstract
I don't agree with this view, see below.
: types inherently possess subprogram pointers, so it should be possible
: to take advantage of this feature as an alternative to explicit
: subprogram accesses.
:
: In Ada 83, I missed being able to do things like this:
:
: with Pack1;
: procedure P1 is
: Error_File : Text_IO.File_Type;
:
: procedure Report_Error (Message : string) is
: begin
: Text_IO.Put_Line (Error_File, Message);
: end Report_Error;
:
: begin
: Text_IO.Create (Error_File, ...
: ...
: Pack1.Do_Some_Big_Procedure_That_Can_Report_Errors (Report_Error);
: -- some people would fire me for using a name like this :)
: ...
: end P1;
:
: The purpose is to call a procedure that can generate error messages,
: and to tell it what I want done with those error messages. Things
: can't be done this way in Ada 83. The problem can be solved using
: generics in Ada 83, but I've always thought of this as a strange
: reason for using generics, and it can get hairy (suppose, for example,
: that the big procedure calls another procedure that also reports
: errors; now that procedure has to be turned into a generic also, and
: so on).
Yes, and the same way you think it's a strange way of employing generics,
I'd also say it's a strange thing to employ objects (of abstract types)
for this simple (!) purpose alone as you propose below.
: In Ada 95, you can accomplish this with a subprogram access, but you
: have to make Report_Error global, and therefore Error_File has to be
: made global also. So doing things this way forces you to give up some
: of the design advantages of using local variables. (It isn't too big
: a problem in the above example, but in more complicated situations,
: making things global can be a real pain.) This is also one of the
: things I missed when I was programming in C, since C doesn't have
: nested procedures.
:
: Another way to do this is with an abstract type. (PLEASE NOTE: I
: don't guarantee that my Ada 95 syntax is correct!) You can declare an
: "error handler" in some global package like this:
Compare my other response in this thread for remarks about the
implementation of the discussed language feature.
Thomas Wolff
next prev parent reply other threads:[~1996-07-09 0:00 UTC|newest]
Thread overview: 133+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-07-02 0:00 Q: access to subprogram tmoran
1996-07-02 0:00 ` Robert A Duff
1996-07-02 0:00 ` Robert Dewar
1996-07-03 0:00 ` Jon S Anthony
1996-07-03 0:00 ` Mark A Biggar
1996-07-03 0:00 ` Robert A Duff
1996-07-03 0:00 ` Robert Dewar
1996-07-09 0:00 ` Thomas Wolff
1996-07-09 0:00 ` Robert Dewar
1996-07-10 0:00 ` Robert A Duff
1996-07-10 0:00 ` Richard A. O'Keefe
1996-07-10 0:00 ` Robert Dewar
1996-07-10 0:00 ` Robert A Duff
1996-07-10 0:00 ` Thomas Wolff
1996-07-10 0:00 ` Robert A Duff
1996-07-10 0:00 ` Robert Dewar
1996-07-03 0:00 ` Robert Dewar
1996-07-06 0:00 ` Robert A Duff
1996-07-08 0:00 ` Norman H. Cohen
1996-07-08 0:00 ` Robert Dewar
1996-07-11 0:00 ` Robert A Duff
1996-07-12 0:00 ` Robert A Duff
1996-07-14 0:00 ` Norman H. Cohen
1996-07-03 0:00 ` Robert Dewar
1996-07-03 0:00 ` Robert A Duff
1996-07-08 0:00 ` Norman H. Cohen
1996-07-09 0:00 ` Robert A Duff
1996-07-19 0:00 ` Brian Rogoff
1996-07-22 0:00 ` Richard A. O'Keefe
1996-07-23 0:00 ` Brian Rogoff
1996-07-23 0:00 ` Robert A Duff
1996-07-26 0:00 ` Brian Rogoff
1996-07-28 0:00 ` Robert A Duff
1996-07-22 0:00 ` Brian Rogoff
1996-07-23 0:00 ` Robert A Duff
1996-07-24 0:00 ` Brian Rogoff
1996-07-26 0:00 ` Robert A Duff
1996-07-30 0:00 ` Brian Rogoff
1996-07-24 0:00 ` Richard A. O'Keefe
1996-07-26 0:00 ` Ken Garlington
1996-07-30 0:00 ` Richard A. O'Keefe
1996-07-24 0:00 ` Brian Rogoff
1996-07-26 0:00 ` Richard A. O'Keefe
1996-07-28 0:00 ` Fergus Henderson
1996-07-28 0:00 ` Robert A Duff
1996-07-29 0:00 ` Richard A. O'Keefe
1996-07-29 0:00 ` Robert A Duff
1996-07-29 0:00 ` Richard A. O'Keefe
1996-07-30 0:00 ` Jon S Anthony
1996-07-03 0:00 ` Fergus Henderson
1996-07-03 0:00 ` Robert A Duff
1996-07-03 0:00 ` Adam Beneschan
1996-07-03 0:00 ` Robert Dewar
1996-07-03 0:00 ` Robert A Duff
1996-07-09 0:00 ` Thomas Wolff [this message]
1996-07-03 0:00 ` Robert Dewar
1996-07-05 0:00 ` Jon S Anthony
1996-07-06 0:00 ` Robert Dewar
1996-07-06 0:00 ` Robert A Duff
1996-07-06 0:00 ` Robert Dewar
1996-07-08 0:00 ` Robert A Duff
1996-07-08 0:00 ` Richard A. O'Keefe
1996-07-08 0:00 ` Robert A Duff
1996-07-08 0:00 ` Robert Dewar
1996-07-08 0:00 ` Robert Dewar
1996-07-10 0:00 ` Richard A. O'Keefe
1996-07-10 0:00 ` Robert Dewar
1996-07-19 0:00 ` Richard A. O'Keefe
1996-07-07 0:00 ` Mark Eichin
1996-07-08 0:00 ` Richard Kenner
1996-07-07 0:00 ` Ronald Cole
1996-07-07 0:00 ` Richard Kenner
1996-07-07 0:00 ` Robert Dewar
1996-07-07 0:00 ` Richard Kenner
1996-07-07 0:00 ` Robert Dewar
1996-07-14 0:00 ` Ronald Cole
1996-07-14 0:00 ` Richard Kenner
1996-07-15 0:00 ` Fergus Henderson
1996-07-15 0:00 ` Robert Dewar
1996-07-17 0:00 ` Fergus Henderson
1996-07-17 0:00 ` Richard Kenner
1996-07-17 0:00 ` Adam Beneschan
1996-07-20 0:00 ` Michael Feldman
1996-07-20 0:00 ` Robert Dewar
1996-07-16 0:00 ` Richard Kenner
1996-07-08 0:00 ` Brian Rogoff
1996-07-11 0:00 ` Norman H. Cohen
1996-07-11 0:00 ` Magnus Kempe
1996-07-11 0:00 ` Robert Dewar
1996-07-09 0:00 ` Jon S Anthony
1996-07-09 0:00 ` Robert Dewar
1996-07-09 0:00 ` Jon S Anthony
1996-07-09 0:00 ` Robert Dewar
1996-07-09 0:00 ` Robert Dewar
1996-07-10 0:00 ` Ronald Cole
1996-07-11 0:00 ` Richard Kenner
1996-07-11 0:00 ` Robert Dewar
1996-07-11 0:00 ` Jon S Anthony
1996-07-11 0:00 ` Robert Dewar
1996-07-15 0:00 ` Mark A Biggar
1996-07-15 0:00 ` Robert Dewar
1996-07-11 0:00 ` Tucker Taft
1996-07-17 0:00 ` Brian Rogoff
1996-07-12 0:00 ` Jon S Anthony
1996-07-12 0:00 ` Robert Dewar
1996-07-15 0:00 ` Jon S Anthony
1996-07-15 0:00 ` Robert Dewar
1996-07-11 0:00 ` Jon S Anthony
1996-07-11 0:00 ` Robert Dewar
1996-07-11 0:00 ` Jon S Anthony
1996-07-12 0:00 ` Brian Rogoff
1996-07-16 0:00 ` Magnus Kempe
1996-07-14 0:00 ` Ronald Cole
1996-07-14 0:00 ` Robert Dewar
1996-07-15 0:00 ` Jon S Anthony
1996-07-15 0:00 ` Robert Dewar
1996-07-16 0:00 ` Brian Rogoff
1996-07-24 0:00 ` Jon S Anthony
1996-07-25 0:00 ` Fergus Henderson
1996-07-25 0:00 ` David Kristola
1996-07-26 0:00 ` Robert A Duff
1996-07-30 0:00 ` Thomas Wolff
1996-07-30 0:00 ` Robert A Duff
1996-07-30 0:00 ` David Kristola
1996-07-26 0:00 ` Robert A Duff
1996-07-26 0:00 ` Fergus Henderson
1996-07-28 0:00 ` Robert A Duff
1996-07-28 0:00 ` Fergus Henderson
1996-07-25 0:00 ` Jon S Anthony
-- strict thread matches above, loose matches on Subject: below --
1996-07-05 0:00 tmoran
1996-07-06 0:00 ` Robert A Duff
1996-07-15 0:00 tmoran
1996-07-15 0:00 ` Robert Dewar
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox