Re: [Rd] Possible changes to connections

From: mel <mel_at_altk.com>
Date: Thu, 31 May 2007 09:36:43 +0200

Prof Brian Ripley a écrit :

> When I originally implemented connections in R 1.2.0, I followed the model
> in the 'Green Book' closely. There were a number of features that forced
> a particular implementation, and one was getConnection() that allows one
> to recreate a connection object from a number.

I'm currently using connections (socketConnection(), etc) and I first want to *thank you* for this nice work. (imho, it's so much simpler than the underlying C/C++ stuff.)

> I am wondering if anyone makes use of this, and if so for what?

I use getConnection().
In the context in which I use it, the number of the connection is known a priori.
So getConnection() is an easy way to access to the connection for the functions which need to.
I do not however pretend this is the best way to proceed.

> It would seem closer to the R philosophy to have connection objects that
> get garbage collected when no R object refers to them. This would allow
> for example
> ... readLines(con <- gzfile("foo.gz")); close(con)
> which is a little awkward but more importantly seems little understood.

There could be/was the same debate in C/C++. That's may be just a matter of education about not forgetting to close previously opened doors !

> What I suspect is that very few users are aware of the Green Book
> description and so we have freedom to make some substantial changes
> to the implementation. Both issues suggest that connection objects should
> be based on external pointers (which did not exist way back in 1.2.0).

I'm not skilled enough for any advice here, but from a simple user point of view, I just hope it could continue to be as simple and practical as today.
And I renew my thanks for the existing tool (and also the rest !).



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu 31 May 2007 - 07:54:00 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 31 May 2007 - 17:33:46 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.