From sfalcon at fhcrc.org  Fri Nov  3 15:48:31 2006
From: sfalcon at fhcrc.org (Seth Falcon)
Date: Fri, 03 Nov 2006 06:48:31 -0800
Subject: [Rd] Formal methods are not loaded from NAMESPACE in
	reloadedworkspace image
In-Reply-To: <454B4AFD.6030406@r-project.org> (John Chambers's message of "Fri,
	03 Nov 2006 08:58:21 -0500")
References: <E4A9111DA23BA048B9A46686BF727CF461BDF9@DEFRAXMB01.corp.amvescap.net>
	<454B4AFD.6030406@r-project.org>
Message-ID: <m2d584pow0.fsf@ziti.local>

John Chambers <jmc at r-project.org> writes:

> I haven't had a chance to verify these exact examples, but the likely 
> explanation is that loading the workspace does not cache the  saved 
> methods.  Assuming this is indeed what's happening, the workaround is to 
> cache them "manually" by the call:
>
>   cacheMetaData(.GlobalEnv)
>
> (after attaching the relevant library)
>
> It would be nice to have the same effect occur automatically, but there 
> may be issues since the needed class definitions may not be available 
> when the saved workspace is reloaded.
>
> A natural question to ask is whether there is some practical motivation 
> for this exercise.

The main use case is that since serialization of objects is such an
R-ish thing to do, you really want to have deserialized S4 instances
"work" properly when loaded.

I admit that it is also useful to be able to load an arbitrary object
and inspect it even if it will be "broken" (without this, it would be
very hard to write any sort of automated class update code).  It would
seem that this behavior could be achieved in a force=TRUE mode and
that otherwise, it would be an error to deserialize an S4 instance
when the class def is not available.

+ seth



[Rd] Formal methods are not loaded from NAMESPACE in reloadedworkspace image
Seth Falcon