[Rd] save/load hooks
Prof Brian D Ripley
Fri, 21 Jul 2000 20:07:22 +0100 (BST)
On Fri, 21 Jul 2000, Timothy H. Keitt wrote:
> I'd like to suggest a small feature be added to R. It would be nice if
> "load" and "save" had function hooks for object initialization and
> finalization, e.g.,
> load.hook <- function(x) UseMethod("load.hook")
> save.hook <- function(x) UseMethod("save.hook")
> These would then be called on each object saved or loaded. The default
> method would do nothing. This would allow saved objects to
> reinitialize their state when loaded.
R objects contain their complete state as far as R is concerned. Could you
give us an example of why you want this? I guess you must have some
non-standard objects in mind, in which case it seems wasteful to do this
for all R objects in a workspace.
Another potential problem on loading is ordering: how do you ensure that
what you want to do is already available? The workspace is loaded before
any profiles, so only a minimal set of functions is available, excludng any
packages bar base. And the error handling at that stage is I think
incomplete, given that tey() does not work in profiles.
Brian D. Ripley, email@example.com
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 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
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: firstname.lastname@example.org