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@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel