From: rio4ruby Date: 2005-08-29T08:24:13+09:00 Subject: Re: Rio 0.3.3 Dave Burt wrote: > I was going to ask for rio("cmdio:foo") and friends > rio("stdin:") etc., but I tried it and it works... just needs to be > documented in INTRO. > > ... > > It would also be nice to have a more reader-friendly way to create Rios of > these different types. You could accept a Symbol as the first argument: > rio(:fd, 2) > rio(:string, my_string) > rio(:stdin) > rio(:stdio) > rio(:cmdio, "sort") > You're a damn genius, aren't you :) The reason 'stdin:', 'stdout:", etc. are not documented, is that they are not currently part of the published interface. I also noticed that if you move the colon to the begining and removed the quotes, you have a symbol. I have not decided whether to have the string form, the symbol form or both be part of the documented interface. The string form is not actually an alternative syntax. It is core to Rio. rio(?-) is immediatly converted to rio('stdio:') Internally all resources are converted to a URL-like syntax, a IORL if you like. The fully qualified IORL for stderr is rio:stderr: Rio, of course, assumes the 'rio:' part, if missing. You may have noticed also, that if you drop the 'r', you have io:stderr: A readable, language neutral, way of addressing I/O within a program. Similar to localhost in a URL, io:stdin: always refers to stdin of the current process. My ideas in this area are not fully hashed out -- hence the lack of documentation. Cheers, -Christopher