Skip to content

Add support for RBS, Ruby type signature#15881

Closed
qnighy wants to merge 2 commits intoprotocolbuffers:mainfrom
qnighy:rbs
Closed

Add support for RBS, Ruby type signature#15881
qnighy wants to merge 2 commits intoprotocolbuffers:mainfrom
qnighy:rbs

Conversation

@qnighy
Copy link
Contributor

@qnighy qnighy commented Feb 20, 2024

This PR adds support for RBS, a standard type signature format for Ruby. With this, Ruby programmers working on google-protobuf get better typechecking/completion/documentation experience with IDEs they are using (e.g. RubyMine and Steep).

"Support" here includes:

  • Support for RBS in protoc
  • RBS type definitions generated by protoc for built-in types
  • RBS type definitions for the runtime
  • RBS type definitions for the private implementation, which can then be partially checked by the Steep type checker

Here is the rationale of the all-in-one change:

  • The generated types and the runtime types should work in unison, so it is best to have them in the same repository. Note that the types are not just a priori reflection of the runtime, as they include type aliases, interfaces, and type parameters.
  • The generated types describe how the protobuf runtime works, so it is reasonable to write the generator in the same repository as the runtime.

But I'm willing to split the PR into smaller pieces if that's better.

This PR adds a new language --rbs_out rather than extending the --ruby_out generator. This is to generate these files in a different place: we need to put the type definitions under ./sig, whereas we usually put the implementation under ./lib.

The FFI implementation is checked by Steep to some extent, but there are a lot of suppressed errors, many of which require refactoring of the implementation. In this PR, only the trivial fixes to grammatical mistakes are applied.

@qnighy qnighy requested review from a team as code owners February 20, 2024 06:55
@qnighy qnighy requested review from ericsalo and zhangskz and removed request for a team February 20, 2024 06:55
@zhangskz zhangskz requested review from haberman and removed request for a team, ericsalo and zhangskz February 21, 2024 16:41
@zhangskz
Copy link
Member

There is another issue #9495 and PR #15633 open for this as well -- @haberman can you take a look at this PR and how RBS should best be landed?

@HoneyryderChuck
Copy link
Contributor

FWIW I approve the direction of this MR 👍 looking forward to some feedback.

@github-actions
Copy link

We triage inactive PRs and issues in order to make it easier to find active work. If this PR should remain active, please add a comment.

This PR is labeled inactive because the last activity was over 90 days ago. This PR will be closed and archived after 14 additional days without activity.

@github-actions github-actions bot added the inactive Denotes the issue/PR has not seen activity in the last 90 days. label Jun 26, 2024
@github-actions
Copy link

We triage inactive PRs and issues in order to make it easier to find active work. If this PR should remain active or becomes active again, please reopen it.

This PR was closed and archived because there has been no new activity in the 14 days since the inactive label was added.

@github-actions github-actions bot closed this Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

inactive Denotes the issue/PR has not seen activity in the last 90 days.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants