home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!spool.mu.edu!agate!linus!linus.mitre.org!linus!mbunix!eachus
- From: eachus@oddjob.mitre.org (Robert I. Eachus)
- Newsgroups: comp.lang.ada
- Subject: Re: Language pitfalls (was Re: FORTRAN bug)
- Message-ID: <EACHUS.92Dec16203121@oddjob.mitre.org>
- Date: 17 Dec 92 01:31:21 GMT
- References: <1992Dec15.135539.7245@lth.se> <EMERY.92Dec15095542@dr_no.mitre.org>
- <1992Dec15.180821.17817@beaver.cs.washington.edu>
- <1992Dec15.203558.18211@inmet.camb.inmet.com>
- <EACHUS.92Dec15202249@oddjob.mitre.org> <256@visicom.com>
- Sender: news@linus.mitre.org (News Service)
- Organization: The Mitre Corp., Bedford, MA.
- Lines: 39
- In-Reply-To: rlk@VisiCom.COM's message of 16 Dec 92 17:38:07 GMT
- Nntp-Posting-Host: oddjob.mitre.org
-
-
- 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...
-