Replies: 1 comment 2 replies
-
I'm +1 for this. Can you submit a PR for this like |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want
bundle gem --ext=go
in bundler. (like Rust)Pros
Go has some excellent features that other languages do not have, such as goroutine and Channels.
I believe these would be more convenient if these features were available from Ruby.
Below is a benchmark comparing Ractor and goroutine.
In my benchmark, goroutine is about x26-28 faster than Ractor 💨
Details
Original idea is @mmasaki 's https://rubykaigi.org/2015/presentations/mmasaki/
At the time of his talk (2015), Go did not have a standard package manager.
So I think he had to create his own binding to call CRuby functions from Go.
However, there is now a standard package manager called Go module.
I auto-generated (almost) all of Go's bindings automatically from
ruby.h
. (about 1,100 functions)https://github.com/sue445/go-gem-wrapper/blob/v0.1.0/ruby/function_generated.go
What features are needed in the bundler
I made this little script to make the skeleton into a Go gem right after doing
bundle gem --ext=c
.https://github.com/sue445/go-gem-wrapper/tree/main/_tools/patch_for_go_gem
However, I believe that if bundler itself had equivalent functionality like Rust, many people would be able to use this.
I would like to port what we are doing in
patch_for_go_gem.rb
to bundler if I can get the approval of others.Other idea
Adding functionality to the bundler core every time we add more supported languages to the
bundle gem
also seems like a high barrier.And I think it's hard for bundler maintainers to keep maintaining many language templates...
Therefore, it might be useful to add a plugin mechanism to the
bundle gem
so that everyone can write native extension in their favorite language more casually.e.g.
bundle gem my_gem --template=bundler-gem-go
bundler has a plugin mechanism.
https://bundler.io/guides/bundler_plugins.html
But it does not seem to extend
bundle gem
.What do you all think?
Beta Was this translation helpful? Give feedback.
All reactions