2007/7/3, Ronald Fischer <ronald.fischer / venyon.com>: > > This creates some awful situations, like having a file called '-' and > > doing ./script * . I'm against it - it's a hack. > > I think that's why people try to avoid filenames like "-" at all. You > run into > the same problem if you do for example one of > > grep foo * > tail -f - # Reads from stdin. Use tail -f <- to read from file '-' It's not exactly equivalent. The equivalent command would be tail -f ./- :-) > At least this is true if you are working in a "Gnu environment" (Linux, > Cygwin,...); > I don't know about Solaris or HP-UX. > > For similar reasons, we usually avoid filenames containing spaces, > non-printable > characters and so on, even if they are perfectly valid. > > Of course the "Magic '-'" feature, if it would ever go into Ruby, must > not be > there unconditionally; the programmer still needs to be in control on > whether > or not she wants to have it implemented (this could maybe be done by > providing a > separate "open" call, say: File.open_magic_dash). IMHO the question is whether a string is the proper interface to a method. Consider this: def write_stuff_file(out) File.open(out, "w") do |io| io << ... end end vs. def write_stuff_stream(out) out << ... end The second form is more flexible than the first one because you can pass not only file names but IO objects, Strings, StringIOs etc. And the second method does not need the "-" hack because you can just pass $stdout. Also, when using ARGF for reading then you automatically get input from stdin if there are no arguments in ARGV. This is another situation where you do not need "-" as representative for stdout or stdin. Kind regards robert -- Have a look: http://www.flickr.com/photos/fussel-foto/