From hb at stat.berkeley.edu  Tue Sep 19 22:28:29 2006
From: hb at stat.berkeley.edu (Henrik Bengtsson)
Date: Tue, 19 Sep 2006 13:28:29 -0700
Subject: [Rd] wishlist --- menu entry [Rgui] misc --- stop current
	computation
In-Reply-To: <Pine.LNX.4.64.0609191845040.2465@gannet.stats.ox.ac.uk>
References: <556e90a80609191034ma98b7e8o9fe38091b81ce7e6@mail.gmail.com>
	<Pine.LNX.4.64.0609191845040.2465@gannet.stats.ox.ac.uk>
Message-ID: <59d7961d0609191328xdfeef15u83b065d46120dfd0@mail.gmail.com>

On 9/19/06, Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
> On Tue, 19 Sep 2006, Kjetil Halvorsen wrote:
>
> > This is from R-2.4.0alpha on windows XP, downloaded from CRAN yesterday.
> >
> > I did
> > update.packages(destdir= ..., ask=FALSE,checkBuilt=TRUE)
> >
> > which took quite a long time (as.expected). When the internet cafe
> > had to close, I had to stop the downloading, but the menu item
> > misc --- stop current computation only stopped the current download,
> > and then R imeadiaetely continued whit the next in the waitin list, so I had
> > to kill
> > R. I  would be nice if this could be corrected so it really
> > stopped all the waiting computastion!
>
> As it does what it says, it cannot be 'corrected' to do something else.
> I usually find hitting Ctrl-C (or ESC in Rgui) a few times breaks out
> here.
>
> The issue is that update.packages (or more precisely download.packages)
> has a loop of try() constructs, and those are trapping interrupts.
> I don't think there is any way to distinguish those from other internal
> errors.  In any case, it is a somewhat delicate question as to what you
> want: do you want pending on.exit() actions done, for example?

Without digging into the update.packages() et al code, wouldn't a
distinction between 'error' and 'interrupt' using tryCatch() rather
than try() solve this?  ...assuming "stop current computation" signals
some kind of interrupt.

Some additional thoughs:  It would be very useful if we could define
different 'condition' classes that can be caught or let through using
tryCatch().  Then higher-level methods such as source() and example()
can then be made sensitive to these.  For example:

simpleExit extends simpleCondition: A script can throw this to signal
to example() or source() that it want to exit the evaluation nicely,
cf. stop().  See also R-devel topic "[Rd] New simpleExit() condition
(Was: Re: Can example() code stop the example without generating an
error?)" on March 14, 2006.

/Henrik

>
> --
> Brian D. Ripley,                  ripley at stats.ox.ac.uk
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford,             Tel:  +44 1865 272861 (self)
> 1 South Parks Road,                     +44 1865 272866 (PA)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>




[Rd] wishlist --- menu entry [Rgui] misc --- stop current computation
Henrik Bengtsson