rbs
rbs copied to clipboard
[Epic] Pure C API
Shopify is actively working on decoupling the RBS parser from its Ruby bindings, in order to expose a new pure C API.
This API will be more compatible (e.g. it can integrate into JRuby, Truffle, Sorbet, etc.), and will allow for multi-threaded RBS parsing (since it won't be blocked by Ruby's GVL).
PR list
This is still a work-in-progress, but this list will be updated to list all PRs that are ready to review, in the order that they should be merged.
- [x] #2098
- [x] #2102
- [x] #2128
- [x] #2131
- [x] #2132
- [ ] #2175
- [ ] #2221
CC @Morriar, @soutaro
It looks like all the linked PRs have been merged. Is this done? Is there a way to get a prerelease gem pushed for testing, or JRuby added to CI?
The main missing part would be https://github.com/ruby/rbs/pull/2398.
@Morriar Ok thank you for that update!
In #2433 I noticed there are still a number of places that the ruby.h file and friends are required. I'm not sure if #2398 addresses all of those but any dependency on the header files from CRuby will likely need to be addressed in order for the library to build and run with JRuby.
I am standing by to help. The current dependencies prevent doing much on my end, though.
With https://github.com/ruby/rbs/pull/2398, ruby.h isn't required anymore.
Here's how we use it from Sorbet (C++ implementation): https://github.com/sorbet/sorbet/blob/master/rbs/rbs_common.h#L5 and we don't need the Ruby VM.