From ripley at stats.ox.ac.uk  Tue Dec  6 07:41:14 2011
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Tue, 06 Dec 2011 06:41:14 +0000
Subject: [Rd] unserialize and eager execution
In-Reply-To: <CAH9pPRpT1e5uwWnL453vY0ryCfkMTsp0Xk2z2yOq0vacY_i5xA@mail.gmail.com>
References: <CAH9pPRpT1e5uwWnL453vY0ryCfkMTsp0Xk2z2yOq0vacY_i5xA@mail.gmail.com>
Message-ID: <4EDDB90A.5000205@stats.ox.ac.uk>

Take a look at the information on serialization in 'R Internals'. 
AFAICS this is no different from what can happen when loading a saved 
workspace.

On 06/12/2011 05:29, Tyler Pirtle wrote:
> Hi,
>
> While debugging a network server I'm developing I noticed something unusual
> - call to unserialize() resulted in
> an error about loading a namespace.
>
> I was a bit taken back by this - why should unserializing an object cause a
> namespace lookup?
> Are there any other side-effects of unserialize() that I should be cautious
> about? I've been
> digging through the R_Unserialize() call, I haven't found the loadNamespace
> bit yet but I
> assume its in there somewhere.
>
> Is there anyway to guard against R eagerly evaluating serialized data
> (serialize()) being unserialized (unserialize()) ?

Don't unserialize 'eagerly'.  Hint: that's what lazy-loading does.

>
>
> Thanks,
>
>
> Tyler
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel


-- 
Brian D. Ripley,                  ripley at 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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] unserialize and eager execution
Prof Brian Ripley