On Aug 22, 2006, at 10:37 PM, John Johnson wrote: > On Tue, 22 Aug 2006 17:44:42 -0400, Logan Capaldo > <logancapaldo / gmail.com> wrote: > >> >> On Aug 22, 2006, at 1:36 PM, John Johnson wrote: >>> How about: >>> >>> oblivion = File.open(nil, 'w') >>> >>> Seems intuitive. >>> >> >> For what definition of intuitive? nil is not a path, it's not even >> a string that could represent a path. > > Exactly. > > What happens when you write to a nil file? Nothing. > You get an exception when you write to a nil file in ruby. >> file = nil => nil >> file.write "Whee" NoMethodError: undefined method `write' for nil:NilClass from (irb):2 Which is as it should be. > Where does the stuff go? Nowhere. > nil is not a file. It is also not "nowhere". (If it was nowhere, it would probably behave a bit more like Objective-C's nil). Even if it was nowhere, we would have all sorts of fun tracking down bugs where we meant to open a file ( a real file ) and forgot to check for nil earlier in the code. Our output would unintentionally disappear never to be seen again. Also the docs would be especially fun, "File.open takes a path to file and a mode, well sometimes it takes nil, which means open the platform specific 'bitbucket'". Repurposing nil for this is not a good idea IMO. It reminds me of perl where writing to unopened file handles silently throws data away. > Oh yeah, it also doesn't have to be translated into 150 languages > like 'bit bucket' would. > "bit bucket" is not the only possible name for this. > Regards, > JJ > > > -- > Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ > >