Re: [Rd] Enhancement request: anonymous connections

From: Byron Ellis <ellis_at_stat.harvard.edu>
Date: Thu 29 Dec 2005 - 05:17:44 GMT

I think what you're suggesting is that connections should become first-class citizens in the R world by becoming a CONSXP, an EXTPTRSXP + Finalizer or whatever (which wouldn't bother me a bit, BTW). Then they'd play by the same rules as everything else, although you might want to have an explicit close as well as a close on finalize, that way you could close and then reopen if you keep a reference around (It also really annoys me that close NULLs the value of the symbol right now). It'd also be nice to *gasp* have an API for I/O from the C side of things as well.

If we wanted to be truly radical we'd just accept that graphics devices and event loops are just special cases of the connection and merge the whole thing, thus more-or-less reinventing CLIM. :-)

On Dec 28, 2005, at 6:50 AM, Seth Falcon wrote:

> On 27 Dec 2005, murdoch@stats.uwo.ca wrote:
>> This is a bug in load, isn't it? load() opens the connection but
>> doesn't close it.
>
> Well, it may be that load needs a small fix, but that doesn't fix
> anonymous connections in general, IMO.

>
> The loop could easily have been:
>
> for (i in 1:50) {
> print(load(url(testUrl, open="r")))
> }
>
> And it doesn't need to be related to url or load:
>
> cat("a line of text\n", file="another-example.txt")
> z <- NULL
> for (i in 1:50) {
> z <- c(z, readLines(file("another-example.txt", open="r")))
> }
>
> Also, connections are "in use" even if they are closed:
>
> for (i in 1:50) {
> if (isOpen(file("another-example.txt")))
> stop("you will not get here")
> }
>
>
> --
> + seth
>
> ______________________________________________
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

---
Byron Ellis (ellis@stat.harvard.edu)
"Oook" -- The Librarian

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Thu Dec 29 16:29:14 2005

This archive was generated by hypermail 2.1.8 : Mon 20 Feb 2006 - 03:21:35 GMT