socketry / io-event

MIT License
66 stars 15 forks source link

warning: IO::Buffer is experimental #82

Closed emiltin closed 11 months ago

emiltin commented 11 months ago

Hi, When using the async gem with Ruby 3.2.2 on macOS, I get this warning:

/Users/emiltin/.local/share/rtx/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/io-event-1.3.2/lib/io/event/support.rb:24: warning: IO::Buffer is experimental and both the Ruby and C interface may change in the future!

This seems to come from the Ruby stdlib, but is there anyway to avoid it at the momemt?

ioquatix commented 11 months ago

This warning is pointing out that io-event could potentially break on a future version of Ruby. However, that is unlikely to occur in practice as the impact would be pretty big.

I hope to finish IO::Buffer by Ruby 3.3 so the warning will be removed when that happens.

In terms of removing the warning before that, we could probably silence it, but I suppose that defeats the purpose of the warning.

emiltin commented 11 months ago

Thank you for the info! I agree, silencing the warning would not be a good idea. I was wondering if it was perhaps an issue with my installation, but I'll just leave the warning be.

trevorturk commented 11 months ago

FWIW I silenced with a Ruby version check so I'll remember to check again later, like so:

Kernel.silence_warnings do
  raise("check IO::Buffer warning") unless RUBY_VERSION == "3.2.2"
  Bundler.require(*Rails.groups)
end

Please don't be mad at me, I know it's bad form! 😉

kmcphillips commented 7 months ago

A softer approach than silencing all warnings, you can suppress just the experimental ones:

original, Warning[:experimental] = Warning[:experimental], false
Bundler.require(*Rails.groups)
Warning[:experimental] = original

Or use the ruby -W:no-experimental flag at runtime.

ioquatix commented 7 months ago

If you are running on Ruby 3.3, this warning should no longer be emitted:

https://github.com/socketry/io-event/commit/0ebd3c01b2f4665930215a1d47d45200799d97e2#diff-cc36f5f34855b6bba9affc5bbc47b7a56d0c352e09704260126cec991843aa72R23