rbs icon indicating copy to clipboard operation
rbs copied to clipboard

stringio should be a stdlib, but it's in `core/`

Open pocke opened this issue 2 years ago • 1 comments

In Ruby, stringio is a stdlib. https://github.com/ruby/ruby/tree/50520cc1930331bccdb94730e17ddc01798f2be0/ext/stringio

But currently, RBS has string_io as a core library unexpectedly. https://github.com/ruby/rbs/blob/abcc97d3c8b024856ba9603a7ef22d422652ff42/core/string_io.rbs

So we should do the two things:

  • Move string_io.rbs from core/ to stdlib/.
  • Rename it to stringio.rbs
    • because the library name is stringio.

BTW, this will introduce a breaking change. We should do it carefully. For example, we can provide a migration process.

pocke avatar Sep 27 '23 09:09 pocke

I have a proposal.

Our goal

I believe stringio is already gemmed and the goal is to move to gem. https://github.com/ruby/stringio

Problem

One thing to be aware of regarding migration is older versions of rbs. The following are possible problems with older rbs.

  • Moving to gem conflicts with core in old rbs
  • Adding stringio to manifest.yaml of gems in gem_rbs_collection crashes with error when loaded in old rbs.

Proposal

  1. Move to stdlib from core.
    • Read RBS from gem if exists in rubygems
    • Otherwise, always load RBS from stdlib.
  2. Add stringio to manifest.yaml for cgi, csv, and open-uri in stdlib
    • Release
  3. Wait for penetration...
  4. If StringIO is found in RBS without stringio in both manifest.yaml and gem dependencies, issue a warning.
    • Optional because I don't know if I can do it.
    • Release
  5. Add stringio to the manifest.yaml of gem_rbs_collection.
    • If executed too soon, errors will occur with old rbs.
  6. Move to gem from stdlib.

ksss avatar Dec 03 '24 07:12 ksss