Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RBS types #148

Open
mscwilson opened this issue Oct 13, 2021 · 1 comment
Open

Add RBS types #148

mscwilson opened this issue Oct 13, 2021 · 1 comment
Labels
type:enhancement New features or improvements to existing features.
Milestone

Comments

@mscwilson
Copy link
Contributor

Currently, this tracker uses the Contracts gem. All the public API methods have type checking.

There are a couple of downsides to this. Users who have a Contract class or module in their codebase have a name clash problem. Also, a broken Contract throws an Error, not a warning - mistakes in setting up tracking can lead to RuntimeErrors. Perhaps it would be better to catch mistakes elsewhere in the pipeline?

Ruby 3 introduced a native type checking system called Ruby Signatures. Each .rb file can have a matching .rbs file where the type signature is defined. Although according to this JetBrains survey most Ruby users currently use Ruby 2.7, this is the future of Ruby so it would be great to migrate away from Contracts in favour of RBS.

@mscwilson mscwilson added the type:enhancement New features or improvements to existing features. label Oct 13, 2021
@mscwilson mscwilson added this to the Version 1.0.0 milestone Oct 13, 2021
@mscwilson mscwilson changed the title Replace Contracts with RBS types Add RBS types Nov 1, 2021
@mscwilson
Copy link
Contributor Author

The Contracts gem has been removed from the Ruby tracker (#155), so there is currently no type checking.
Adding RBS files might still be a good idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement New features or improvements to existing features.
Projects
None yet
Development

No branches or pull requests

1 participant