Skip to content
Prev 17317 / 63424 Next

RFC: "loop connections"

On Sat, 27 Aug 2005 dhinds at sonic.net wrote:

            
One has.
That is definitely not what text connections do, and not what I read the 
proposal as being given the analogies to text connections.
That I think is where Hinds' confusion arises.  As the posting guide asks, 
please do your homework before posting.

Text connections are from the Green Book, where they are described as

- a 'text connection' using S character strings as lines of text input

- Text connections are a convenience to make it easy to use an object
   containing character strings in a computation that expects to read
   from a connection.

They are read-only (or in R but not S, write-only).  Think for them as the 
analogues of the C functions sscanf and sprintf.  Output text connections 
are a particularly convenient way to create text labels -- see for example 
capture.output().
That is exactly what read-write anonymous file() connections are designed 
for.  They too come from the Green Book.  (If efficiency were an issue, a 
short purpose-designed C routine would be the answer.  But file 
connections are already much 'smarter' than the proposed implementation of 
loop connections and do allow seeking.)

Another piece of homework might be my article in the very first R 
newsletter.