🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.eiffel
Article #1552

exiting a `rescue' without creating an exception

#1552
From: Eric Gossett
Date: Fri, 09 Feb 1990 20:42
35 lines
1675 bytes
There are currently two options available in a `rescue' clause:

1. Try to fix the root problem and then `retry' the routine.

2. Clean up as gracefully as possible, then create an exception in the
   calling routine.


In some cases, a particular exception may indicate the need to terminate
the routine without a retry or an exception in the calling routine. (For 
example, when finding determinants using a factorization, a step at which
there is no nonzero pivot element would cause a division by zero, but it
also indicates that the determinant is zero.)  At present, such a situation
must be programmed as:

local
  exceptional_case : BOOLEAN; 
do
  if exceptional_case then
    Result := <something>
  else
    <normal, long algorithm>
  end
rescue
  <fix the exception>
  exceptional_case := true;
  retry
end 

 
I would like to propose a new construct that would be an alternative to
`retry', namely, `normal_exit'.  The rescue clause could take appropriate
action, then terminate the routine without raising an exception in the 
calling routine.  This would eliminate the need for the awkward outer loop
in the program skeleton above.
Technical Details
Message-ID: <501@bthpyd.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!aplcen!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!srcsip!bthpyd!gossett

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!aplcen!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!srcsip!bthpyd!gossett
From: gossett@bthpyd.UUCP (Eric Gossett)
Newsgroups: comp.lang.eiffel
Subject: exiting a `rescue' without creating an exception
Message-ID: <501@bthpyd.UUCP>
Date: 9 Feb 90 20:42:49 GMT
Reply-To: gossett@bthpyd.UUCP (Eric Gossett)
Distribution: comp.lang.eiffel
Organization: Bethel College, St. Paul, MN
Lines: 35