code would
end
end
end
That’s interesting, though personally I’d rather just have something in
the core. I mean, we have Dir.tmpdir (in the tmpdir package). Why not
Dir.bitbucket?
Regards,
Dan
This communication is the property of Qwest and may contain confidential
or
privileged information. Unauthorized use of this communication is
strictly
prohibited and may be unlawful. If you have received this communication
in error, please immediately notify the sender by reply e-mail and
destroy
all copies of the communication and any attachments.
On 8/21/06, Berger, Daniel [email protected] wrote:
code would
end
end
end
That’s interesting, though personally I’d rather just have something in
the core. I mean, we have Dir.tmpdir (in the tmpdir package). Why not
Dir.bitbucket?
And, since we’re effectively looking for a write-only file, it seems
that it would be better to make the implementation pure Ruby and
platform independent, sort of like a StringIO without a string,
instead of on platform specific blackholes like /dev/null or the
others. Then it wouldn’t need to change if and when a new platform
was to be supported.
And it would probably throw those bytes away even faster than if it
needed to talk to the OS!
Rick DeNatale
My blog on Ruby
http://talklikeaduck.denhaven2.com/
Hi,
At Tue, 22 Aug 2006 02:21:05 +0900,
Rick DeNatale wrote in [ruby-talk:209686]:
And, since we’re effectively looking for a write-only file, it seems
that it would be better to make the implementation pure Ruby and
platform independent, sort of like a StringIO without a string,
instead of on platform specific blackholes like /dev/null or the
others. Then it wouldn’t need to change if and when a new platform
was to be supported.
It doesn’t work with child processes, which would be expected
in many cases.
I wonder if the name bitbucket is nice.
On Tue, 22 Aug 2006, Daniel B. wrote:
others. Then it wouldn’t need to change if and when a new platform
Dir.devnull
Dan
why ‘Dir’ though? why not File?
-a
[email protected] wrote:
was to be supported.
It doesn’t work with child processes, which would be expected
in many cases.
I wonder if the name bitbucket is nice.
Dir.bitbucket
Dir.devnull
Dir.null_device
Dir.null
Dir.black_hole
I guess I’m leaning towards Dir.null_device in terms of most technically
descriptive. It doesn’t quite roll off the tongue as nicely as
“bitbucket”, though.
Regards,
Dan
On 8/22/06, [email protected] [email protected] wrote:
platform independent, sort of like a StringIO without a string,
Regards,
Agreed. File would be a better location for the it.
Hi,
At Tue, 22 Aug 2006 16:37:34 +0900,
Hal F. wrote in [ruby-talk:209823]:
Agreed. File would be a better location for the it.
Or even IO perhaps?
IO isn’t always associated with a certain path.
I’d prefer File.null.
On Tue, 22 Aug 2006 01:56:17 -0400, Daniel B. [email protected]
wrote:
[email protected] wrote:
Dir.bitbucket
Dir.devnull
Dir.null_device
Dir.null
Dir.black_hole
I guess I’m leaning towards Dir.null_device in terms of most technically
descriptive. It doesn’t quite roll off the tongue as nicely as
“bitbucket”, though.
How about:
oblivion = File.open(nil, ‘w’)
Seems intuitive.
Regards,
JJ
On Aug 22, 2006, at 1:36 PM, John J. wrote:
I guess I’m leaning towards Dir.null_device in terms of most
technically descriptive. It doesn’t quite roll off the tongue as
nicely as “bitbucket”, though.
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.
On Tue, 22 Aug 2006 17:44:42 -0400, Logan C.
[email protected]
wrote:
string that could represent a path.
Exactly.
What happens when you write to a nil file? Nothing.
Where does the stuff go? Nowhere.
Oh yeah, it also doesn’t have to be translated into 150 languages like
‘bit bucket’ would.
Regards,
JJ
On Aug 22, 2006, at 10:37 PM, John J. wrote:
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.
Hi,
At Wed, 23 Aug 2006 02:36:01 +0900,
John J. wrote in [ruby-talk:209921]:
oblivion = File.open(nil, ‘w’)
It is easy in 1.9.
def nil.to_path
“/dev/null”
end
Logan C. wrote:
“bit bucket” is not the only possible name for this.
Yea, I’m thinking a good name would be “bitchbucket”
T.
On 8/22/06, [email protected] [email protected] wrote:
end
The same thing works in 1.8.4
–
Rick DeNatale
My blog on Ruby
http://talklikeaduck.denhaven2.com/