From dhinds at sonic.net  Fri Sep  2 06:12:15 2005
From: dhinds at sonic.net (dhinds@sonic.net)
Date: Fri, 2 Sep 2005 04:12:15 +0000 (UTC)
Subject: [Rd] RFC: rawConnection (was "loop connections")
References: <dedndn$daj$1@sea.gmane.org>
	<17168.15848.291481.473231@stat.math.ethz.ch>
	<df5b90$1ba$1@sea.gmane.org> <431667BC.7050906@stats.uwo.ca>
	<df62er$jab$1@sea.gmane.org> <4316D8B3.3040504@stats.uwo.ca>
	<df7c03$s62$1@sea.gmane.org> <4317B6B5.30709@stats.uwo.ca>
Message-ID: <df8jev$2l6$1@sea.gmane.org>

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



[Rd] RFC: rawConnection (was "loop connections")
dhinds@sonic.net