home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / ada / 3725 < prev    next >
Encoding:
Internet Message Format  |  1992-12-16  |  2.2 KB

  1. Path: sparky!uunet!olivea!spool.mu.edu!agate!linus!linus.mitre.org!linus!mbunix!eachus
  2. From: eachus@oddjob.mitre.org (Robert I. Eachus)
  3. Newsgroups: comp.lang.ada
  4. Subject: Re: Language pitfalls (was Re: FORTRAN bug)
  5. Message-ID: <EACHUS.92Dec16203121@oddjob.mitre.org>
  6. Date: 17 Dec 92 01:31:21 GMT
  7. References: <1992Dec15.135539.7245@lth.se> <EMERY.92Dec15095542@dr_no.mitre.org>
  8.     <1992Dec15.180821.17817@beaver.cs.washington.edu>
  9.     <1992Dec15.203558.18211@inmet.camb.inmet.com>
  10.     <EACHUS.92Dec15202249@oddjob.mitre.org> <256@visicom.com>
  11. Sender: news@linus.mitre.org (News Service)
  12. Organization: The Mitre Corp., Bedford, MA.
  13. Lines: 39
  14. In-Reply-To: rlk@VisiCom.COM's message of 16 Dec 92 17:38:07 GMT
  15. Nntp-Posting-Host: oddjob.mitre.org
  16.  
  17.  
  18. In article <256@visicom.com> rlk@VisiCom.COM (Bob Kitzberger) writes:
  19.  
  20.    Robert, I can't think of a reason to have a function that does nothing
  21.    but raise an exception... can you provide an example?  (I'm not
  22.    questioning the need for it -- just curious)
  23.  
  24.    Stubbing is the major reason for doing this, i.e. something not
  25. available in the current version of the software, but the interface is
  26. provided.
  27.  
  28.    Another case is where a generic requires an operation as a formal
  29. parameter which is meaningless for a particular actual.  There are
  30. cases where providing a function which raises an error is more useful
  31. than rewriting the generic.  For example, assume you have a "standard"
  32. interface to IO devices, for some current_position would return a
  33. value, for other devices the function of the same name would
  34. immediately raise an exception.
  35.  
  36.    A more subtle use in when you are not sure an obsolete interface
  37. or object can be eliminated.  Putting in a function which prints a
  38. meaningful message then returns is more polite than ripping it out,
  39. and waiting until some user of the package screams.
  40.  
  41.    One more use I have found was for a private type where user created
  42. objects were verboten.  (Put in a component with such a function as
  43. the default initial value.  User created objects will cause the
  44. function to be evaluated.)
  45.  
  46.    Lots of uses, but only the difficulties the rule creates in
  47. stubbers is compelling.
  48.  
  49. --
  50.  
  51.                     Robert I. Eachus
  52.  
  53. with Standard_Disclaimer;
  54. use  Standard_Disclaimer;
  55. function Message (Text: in Clever_Ideas) return Better_Ideas is...
  56.