From: Ronald Fischer Date: 2007-07-02T18:00:56+09:00 Subject: Re: Feature Request: Special file '-' denoting stdin/stdout > It should be mentioned that both File.new and File.open are > able to receive file descriptors: This does not help much, because still I would then need to decide at runtime, whether (for example) the number 1 passed via the command line of my program, denotes the file descriptor 1 (stdout) or a file name "1". > If you insist on using "-", you might want to have a look on > either of the implementations below. Both implementations are fine, but I never doubted that we can implement this explicitly per application. My point was that this usage of the "-" has become so common - perhaps because it is heavily used in the Gnu world and is built into Perl as well. As an example for how it works with the Gnu tools, I present a sketch of a bash script: #!/usr/bin/bash # This is file exa1.sh ... fgrep "$1" /var/mail/log $HOME/mailbox $2 ... I have several ways to call it, for example exa1.sh foo # search in /var/mail/log and mailbox exa1.sh bar mailbox.old # search also in mailbox.old genmail | exa1.sh baz - # also search in the stdout of genmail Similar in Perl: If you write open(RCFILE,$ARGV[3]) # This is Perl the user can supply on the command line a dash, and the program would automatically read stdin for RCFILE. Since this is such a common usage of the '-', I suggest that it should be incorporated into Ruby in a similar way as in Perl. Ronald -- Ronald Fischer Phone: +49-89-452133-162