On Oct 18, 2006, at 1:17 PM, Roger D. Peng wrote: > I've encountered a (I think) related problem when using promises to > load relatively large datasets. For example something like > > delayedAssign("x", getBigDataset()) > > runs into the same problem if you hit Ctrl-C while 'x' is being > evaluated for the first time. Afterwards, there's no way to > retrieve the dataset associated with 'x'. > > Active bindings work in this case, but the problem is that I > usually only want to load a large dataset once. >
I agree. There are basically a few options AFAICS: 1) document in delayedAssign that error conditions during evaluation will lead to unusable/unrecoverable state of the promise and add a note discouraging the use of promises in R code (as they were never meant for that) 2) reset PRSEEN on error in eval of the promise code (probably expensive as it would apply to every promise) 3) optionally add a flag to promises created by delayedAssign such that those can be distinguished and handled separately (e.g. don't set PRSEEN, or install an error handler before evaluation to reset PRSEEN). This would not affect the internal use of promises and thus would have no impact on speed. It would, however, make them more robust. 4) add a function that will reset a 'rogue' promise (e.g. recoverDelayed(sym, env)) which could be used in a custom error handler in the promise code. This is basically poor man's version of 3) Personally I would vote for 3), but I can see the arguments for 1). Cheers, Simon ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel