Skip to content
Back to formatted view

Raw Message

Message-ID: <Pine.GSO.4.05.10007211958530.13766-100000@auk.stats>
Date: 2000-07-21T19:07:22Z
From: Brian Ripley
Subject: save/load hooks
In-Reply-To: <39789901.6E8B7656@nceas.ucsb.edu>

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,                  ripley@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 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: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._