From rdpeng at gmail.com  Fri May 19 15:54:15 2006
From: rdpeng at gmail.com (Roger D. Peng)
Date: Fri, 19 May 2006 09:54:15 -0400
Subject: [Rd] delayedAssign and interrupts
Message-ID: <446DCE07.2080504@gmail.com>

I noticed something recently that I thought was odd:

delayedAssign("x", { Sys.sleep(5); 1 })
x  ## Hit Ctrl-C within the first second or 2

gives me:

 > delayedAssign("x", { Sys.sleep(5); 1 })
 > x  ## Hit Ctrl-C within the first second or two

 > x
Error: recursive default argument reference
 >

My only problem here is that now I'm stuck---there's no way to recover whatever 
'x' was supposed to be (i.e. 1).

In reality, I want 'x' to be a promise to load a moderately large data object. 
But if I (or a user) Ctrl-C's during the load I'll have to start from scratch. 
Is there anyway to recover the promise (or the value of the expression) in case 
of an interrupt?

-roger
-- 
Roger D. Peng  |  http://www.biostat.jhsph.edu/~rpeng/



[Rd] delayedAssign and interrupts
Roger D. Peng