ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:115981] [Ruby master Bug#20105] Introduce `IO::Stream` or something similar.
@ 2024-01-01  7:43 ioquatix (Samuel Williams) via ruby-core
  2025-06-04  6:16 ` [ruby-core:122404] [Ruby Feature#20105] " ioquatix (Samuel Williams) via ruby-core
  2025-06-07 20:39 ` [ruby-core:122491] " javanthropus (Jeremy Bopp) via ruby-core
  0 siblings, 2 replies; 3+ messages in thread
From: ioquatix (Samuel Williams) via ruby-core @ 2024-01-01  7:43 UTC (permalink / raw)
  To: ruby-core; +Cc: ioquatix (Samuel Williams)

Issue #20105 has been reported by ioquatix (Samuel Williams).

----------------------------------------
Bug #20105: Introduce `IO::Stream` or something similar.
https://bugs.ruby-lang.org/issues/20105

* Author: ioquatix (Samuel Williams)
* Status: Open
* Priority: Normal
* Assignee: ioquatix (Samuel Williams)
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
Ruby's IO class has a general model for streaming IO, including some hidden classes like `IO::generic_readable` and `IO::generic_writable`.

As Ruby's core IO classes evolve, gems like `openssl` (see `OpenSSL::Buffering`) need to be updated to support changes to the interface.

As it stands, there are changes in `IO` which are not copied to `OpenSSL::Buffering`. I'd like to propose we introduce some shared interface for streams that is used by `IO`, `Socket`, and `OpenSSL` to start with. The general interface would be similar to `IO` and allow code like `OpenSSL` to avoid re-implementing the `IO` interface.



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ruby-core:122404] [Ruby Feature#20105] Introduce `IO::Stream` or something similar.
  2024-01-01  7:43 [ruby-core:115981] [Ruby master Bug#20105] Introduce `IO::Stream` or something similar ioquatix (Samuel Williams) via ruby-core
@ 2025-06-04  6:16 ` ioquatix (Samuel Williams) via ruby-core
  2025-06-07 20:39 ` [ruby-core:122491] " javanthropus (Jeremy Bopp) via ruby-core
  1 sibling, 0 replies; 3+ messages in thread
From: ioquatix (Samuel Williams) via ruby-core @ 2025-06-04  6:16 UTC (permalink / raw)
  To: ruby-core; +Cc: ioquatix (Samuel Williams)

Issue #20105 has been updated by ioquatix (Samuel Williams).

Status changed from Assigned to Closed

In the end, I created a gem for this. I'm okay with using a gem.

https://github.com/socketry/io-stream

----------------------------------------
Feature #20105: Introduce `IO::Stream` or something similar.
https://bugs.ruby-lang.org/issues/20105#change-113577

* Author: ioquatix (Samuel Williams)
* Status: Closed
* Assignee: ioquatix (Samuel Williams)
----------------------------------------
Ruby's IO class has a general model for streaming IO, including some hidden classes like `IO::generic_readable` and `IO::generic_writable`.

As Ruby's core IO classes evolve, gems like `openssl` (see `OpenSSL::Buffering`) need to be updated to support changes to the interface.

As it stands, there are changes in `IO` which are not copied to `OpenSSL::Buffering`. I'd like to propose we introduce some shared interface for streams that is used by `IO`, `Socket`, and `OpenSSL` to start with. The general interface would be similar to `IO` and allow code like `OpenSSL` to avoid re-implementing the `IO` interface.

I don't have a strong idea for the interface yet, but it would probably look something like this:

```ruby
class IO::Stream
  def initialize(io, buffered: true)
  end

  def read(size, buffer=nil)
  end

  def write(size, buffer=nil)
  end
  
  # Include general operations from IO, like gets, puts, etc
end
```

I think ideally we'd try implement with pure Ruby and a first goal would be to replace `OpenSSL::Buffering`.



-- 
https://bugs.ruby-lang.org/
______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ruby-core:122491] [Ruby Feature#20105] Introduce `IO::Stream` or something similar.
  2024-01-01  7:43 [ruby-core:115981] [Ruby master Bug#20105] Introduce `IO::Stream` or something similar ioquatix (Samuel Williams) via ruby-core
  2025-06-04  6:16 ` [ruby-core:122404] [Ruby Feature#20105] " ioquatix (Samuel Williams) via ruby-core
@ 2025-06-07 20:39 ` javanthropus (Jeremy Bopp) via ruby-core
  1 sibling, 0 replies; 3+ messages in thread
From: javanthropus (Jeremy Bopp) via ruby-core @ 2025-06-07 20:39 UTC (permalink / raw)
  To: ruby-core; +Cc: javanthropus (Jeremy Bopp)

Issue #20105 has been updated by javanthropus (Jeremy Bopp).


I'm not sure if it meets your needs, but I just released an update to the [io-like gem](https://rubygems.org/gems/io-like) that brings it into the Ruby 3.x age.  It uses primitive IO functions as a base and implements virtually all of the IO class functionality in pure Ruby.  Please take a look.

----------------------------------------
Feature #20105: Introduce `IO::Stream` or something similar.
https://bugs.ruby-lang.org/issues/20105#change-113680

* Author: ioquatix (Samuel Williams)
* Status: Closed
* Assignee: ioquatix (Samuel Williams)
----------------------------------------
Ruby's IO class has a general model for streaming IO, including some hidden classes like `IO::generic_readable` and `IO::generic_writable`.

As Ruby's core IO classes evolve, gems like `openssl` (see `OpenSSL::Buffering`) need to be updated to support changes to the interface.

As it stands, there are changes in `IO` which are not copied to `OpenSSL::Buffering`. I'd like to propose we introduce some shared interface for streams that is used by `IO`, `Socket`, and `OpenSSL` to start with. The general interface would be similar to `IO` and allow code like `OpenSSL` to avoid re-implementing the `IO` interface.

I don't have a strong idea for the interface yet, but it would probably look something like this:

```ruby
class IO::Stream
  def initialize(io, buffered: true)
  end

  def read(size, buffer=nil)
  end

  def write(size, buffer=nil)
  end
  
  # Include general operations from IO, like gets, puts, etc
end
```

I think ideally we'd try implement with pure Ruby and a first goal would be to replace `OpenSSL::Buffering`.



-- 
https://bugs.ruby-lang.org/
______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-06-07 20:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-01  7:43 [ruby-core:115981] [Ruby master Bug#20105] Introduce `IO::Stream` or something similar ioquatix (Samuel Williams) via ruby-core
2025-06-04  6:16 ` [ruby-core:122404] [Ruby Feature#20105] " ioquatix (Samuel Williams) via ruby-core
2025-06-07 20:39 ` [ruby-core:122491] " javanthropus (Jeremy Bopp) via ruby-core

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).