IO has such methods as #closed? and #eof? to find much-needed information
about IO status, but it doesn't have anything like #read_ready? or #write_ready? that would be useful for anyone not wanting blocking IO. The
only way to do this is with the C-like ugly-hackishness that is
Kernel#select.
Does anyone have a good argument for not adding a few more methods to IO in
the Ruby distribution itself ? Does anybody think it would be a good idea to
submit this as an RCR ? If those are added, would we be able to remove
Kernel#select in the next "we don't care about backward compatibility" Ruby
version ?
IO has such methods as #closed? and #eof? to find much-needed information
about IO status, but it doesn't have anything like #read_ready? or #write_ready? that would be useful for anyone not wanting blocking IO. The
only way to do this is with the C-like ugly-hackishness that is
Kernel#select.
Does anyone have a good argument for not adding a few more methods to IO
in the Ruby distribution itself ?
Not me.
Does anybody think it would be a good idea to submit this as an RCR ?
Go ahead. After submitting it, announce the RCR in ruby-core as well
and let the vote decide. Myself, I'm for adding a few convenience
methods as a wrapper to specific select calls.
If those are added, would we be able to remove Kernel#select in the next
"we don't care about backward compatibility" Ruby version ?
I wouldn't go that far. As I said above, I would probably implement
the convenience methods as wrappers to select, unless performance
issues were to require a lower level implementation. And leaving
access to the unwrapped select would be nearly essential to many
useful libraries.
IO has such methods as #closed? and #eof? to find much-needed information
about IO status, but it doesn't have anything like #read_ready? or #write_ready? that would be useful for anyone not wanting blocking IO. The
only way to do this is with the C-like ugly-hackishness that is
Kernel#select.
Look in RAA for io-wait.
Does anyone have a good argument for not adding a few more methods to IO in
the Ruby distribution itself ? Does anybody think it would be a good idea to
submit this as an RCR ?
It could be useful.
If those are added, would we be able to remove
Kernel#select in the next "we don't care about backward compatibility" Ruby
version ?
No. Kernel#select would still be useful to wait on many IO streams at
once.
harp:~ > ruby a.rb
not blocked @ <Tue Jun 28 14:52:45 MDT 2005>
not blocked @ <Tue Jun 28 14:52:46 MDT 2005>
not blocked @ <Tue Jun 28 14:52:47 MDT 2005>
buf <42>
not blocked @ <Tue Jun 28 14:52:47 MDT 2005>
not blocked @ <Tue Jun 28 14:52:48 MDT 2005>
not blocked @ <Tue Jun 28 14:52:49 MDT 2005>
buf <42>
not blocked @ <Tue Jun 28 14:52:49 MDT 2005>
not blocked @ <Tue Jun 28 14:52:50 MDT 2005>
not blocked @ <Tue Jun 28 14:52:51 MDT 2005>
buf <42>
not blocked @ <Tue Jun 28 14:52:51 MDT 2005>
not blocked @ <Tue Jun 28 14:52:52 MDT 2005>
not blocked @ <Tue Jun 28 14:52:53 MDT 2005>
buf <42>
not blocked @ <Tue Jun 28 14:52:53 MDT 2005>
...
know yer standard libs i don't think this work on windows - but it is in
the standard dist.
hth.
-a
···
On Wed, 29 Jun 2005, C Erler wrote:
IO has such methods as #closed? and #eof? to find much-needed information
about IO status, but it doesn't have anything like #read_ready? or #write_ready? that would be useful for anyone not wanting blocking IO. The
only way to do this is with the C-like ugly-hackishness that is
Kernel#select.
Does anyone have a good argument for not adding a few more methods to IO in
the Ruby distribution itself ? Does anybody think it would be a good idea to
submit this as an RCR ? If those are added, would we be able to remove
Kernel#select in the next "we don't care about backward compatibility" Ruby
version ?
--
email :: ara [dot] t [dot] howard [at] noaa [dot] gov
phone :: 303.497.6469
My religion is very simple. My religion is kindness.
--Tenzin Gyatso