[Rd] RFC: rawConnection (was "loop connections")

dhinds@sonic.net dhinds at sonic.net
Fri Sep 2 06:12:15 CEST 2005


Duncan Murdoch <murdoch at stats.uwo.ca> wrote:

> I think the cost of duplicating as.raw is worse than the cost of using 
> extra memory.  If the lack of symmetry bothers you, a solution is to 
> require a raw object as input.

It wouldn't exactly be duplicating as.raw since this way of converting
to raw is actually to do nothing at all, just to treat the object as
if it is already raw.  But, I don't have a strong opinion.

>  > Currently, textConnection() makes a copy for "r" connections
> > but writes directly to an R object for "w" connections.  The "w" case
> > is buggy; you can crash R by removing the target object while the
> > connection is being used.  I'm not familiar enough with R internals to
> > know how to fix that.  Maybe the object has to be searched for every
> > time the connection is used, to avoid potentially stale pointers?

> I've been having an argument with some other people about something 
> related to this.  I think they would say that the language doesn't 
> support writing to a variable.

I tried changing textConnection output connections to look up the
destination object on every access and that seems to solve the problem
without being terribly expensive.

> If so, then a binary mode rawConnection (with mention of the way to 
> convert in the Rd file) would be good enough for me.

It seems we are coming back to something close to what I had
originally implemented?

-- Dave



More information about the R-devel mailing list