comp.lang.ada
 help / color / mirror / Atom feed
From: eachus@mitre-bedford.arpa  (Robert I. Eachus)
Subject: Re: Language pitfalls (was Re: FORTRAN bug)
Date: 17 Dec 92 01:31:21 GMT	[thread overview]
Message-ID: <EACHUS.92Dec16203121@oddjob.mitre.org> (raw)

In article <256@visicom.com> rlk@VisiCom.COM (Bob Kitzberger) writes:

   Robert, I can't think of a reason to have a function that does nothing
   but raise an exception... can you provide an example?  (I'm not
   questioning the need for it -- just curious)

   Stubbing is the major reason for doing this, i.e. something not
available in the current version of the software, but the interface is
provided.

   Another case is where a generic requires an operation as a formal
parameter which is meaningless for a particular actual.  There are
cases where providing a function which raises an error is more useful
than rewriting the generic.  For example, assume you have a "standard"
interface to IO devices, for some current_position would return a
value, for other devices the function of the same name would
immediately raise an exception.

   A more subtle use in when you are not sure an obsolete interface
or object can be eliminated.  Putting in a function which prints a
meaningful message then returns is more polite than ripping it out,
and waiting until some user of the package screams.

   One more use I have found was for a private type where user created
objects were verboten.  (Put in a component with such a function as
the default initial value.  User created objects will cause the
function to be evaluated.)

   Lots of uses, but only the difficulties the rule creates in
stubbers is compelling.

--

					Robert I. Eachus

with Standard_Disclaimer;
use  Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...

             reply	other threads:[~1992-12-17  1:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1992-12-17  1:31 Robert I. Eachus [this message]
  -- strict thread matches above, loose matches on Subject: below --
1992-12-17 18:48 Language pitfalls (was Re: FORTRAN bug) John Halper
1992-12-17 14:18 Terry J. Westley
1992-12-16 20:59 John Bollenbacher
1992-12-16 20:02 Julian C . Lander
1992-12-16 17:38 Bob Kitzberger
1992-12-16 17:27 Mark A Biggar
1992-12-16 16:32 olivea!spool.mu.edu!yale.edu!qt.cs.utexas.edu!cs.utexas.edu!asuvax!ennews
1992-12-16 14:38 crispen
1992-12-16  1:22 Robert I. Eachus
1992-12-15 20:35 news.centerline.com!noc.near.net!inmet!spock!stt
1992-12-15 18:08 Richard Pattis
1992-12-15 15:47 Michael Feldman
1992-12-15 14:55 David Emery
1992-12-15 13:55 enterpoop.mit.edu!eru.mt.luth.se!lunic!sunic!news.lth.se!dag
1992-12-14 21:57 Bob Kitzberger
replies disabled

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