From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 17 Dec 92 01:31:21 GMT From: eachus@mitre-bedford.arpa (Robert I. Eachus) Subject: Re: Language pitfalls (was Re: FORTRAN bug) Message-ID: List-Id: 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...