From luke@nokomis.stat.umn.edu  Thu Aug 23 18:41:37 2001
From: luke@nokomis.stat.umn.edu (Luke Tierney)
Date: Thu, 23 Aug 2001 12:41:37 -0500
Subject: Interrupts (was Re: [Rd] X11 protocol errors ...)
In-Reply-To: <200108231540.IAA77857@pine.frazmtn.com>; from deleeuw@stat.ucla.edu on Thu, Aug 23, 2001 at 08:40:53AM -0700
References: <5es9otoskjdfdho75hqnrd96h702mt89fr@4ax.com> <200108231540.IAA77857@pine.frazmtn.com>
Message-ID: <20010823124136.A13455@nokomis.stat.umn.edu>

That's a good set of tools for starting from scratch.  But we really
have all the internal harness already in the form of the R context
structure, and Hansen's exception objects are more primitive (not a
criticism: they're designed to be quite simple) than the things we
have in the proposal I mentioned.  Wrapping some macros like Hansen's
or others around what we have isn't hard.

One thing to keep in mind though: whatever tools you use, all code has
to agree on it.  (You can't mix Hansen's macros with R's contexts
since both assume they are the only ones using LONGJMP.)  When the
implementation language provides the mechanism, like C++ or Java
exceptions, you are guaranteed that.  When grafting onto a language
like C you need to put someone in charge and make everyone else play
nice with that one.

luke


On Thu, Aug 23, 2001 at 08:40:53AM -0700, Jan de Leeuw wrote:
> You can get the macros from "C Interfaces and Implementations" by
> David Hanson, Chapter 4. He has some references to other C work
> by Eric Roberts and Steve Maguire on this.
> 
> On Thursday, August 23, 2001, at 05:16 AM, Duncan Murdoch wrote:
> 
> > On Wed, 22 Aug 2001 19:32:51 -0500, you wrote:
> >> I'm surprised we don't get more of these sorts of things on UNIX.  Our
> >> current UNIX interrupt handling approach takes an immediate LONGJMP
> >> out of the signal handler no matter where the signal occurs (except
> >> for two places where signals are suspended).  Any place where an
> >> invariant is temporarily broken, any place where an assignment is not
> >> yet complete, is a potential trouble spot.
> >
> > Delphi protects against these kind of errors with "try ... except ..."
> > and "try ... finally ..." blocks to deal with exceptions.  The first
> > one executes special code if an exception occurs, the second
> > guarantees execution of cleanup code.
> >
> > These are implemented as a linked list of records on the stack which
> > the exception handler knows how to interpret.  When a particular kind
> > of exception occurs, all "finally" blocks are executed in the
> > appropriate order (and the stack base pointer is moved to simulate
> > exits from all active routines) until an "except" block handling the
> > particular kind of exception is reached.
> >
> > C doesn't have these statements built in, but presumably someone has
> > written macros to do the same sort of thing.  Adding them would be a
> > lot of work, but would be worthwhile.
> >
> > Duncan Murdoch
> > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> > .-.-.-
> > r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-
> > FAQ.html
> > Send "info", "help", or "[un]subscribe"
> > (in the "body", not the subject !)  To: r-devel-
> > request@stat.math.ethz.ch
> > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> > ._._._
> >
> 
> ===
> Jan de Leeuw; Professor and Chair, UCLA Department of Statistics;
> US mail: 9432 Boulter Hall, Box 951554, Los Angeles, CA 90095-1554
> phone (310)-825-9550;  fax (310)-206-5658;  email: deleeuw@stat.ucla.edu
> homepage: http://www.stat.ucla.edu/~deleeuw
> ========================================================
>            No matter where you go, there you are. --- Buckaroo Banzai
>                     http://www.stat.ucla.edu/~deleeuw/sounds/nomatter.au
> ========================================================
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

-- 
Luke Tierney
University of Minnesota                      Phone:           612-625-7843
School of Statistics                         Fax:             612-624-8868
313 Ford Hall, 224 Church St. S.E.           email:      luke@stat.umn.edu
Minneapolis, MN 55455 USA                    WWW:  http://www.stat.umn.edu
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


Interrupts (was Re: [Rd] X11 protocol errors ...)
Luke Tierney