Open eregon opened 4 years ago
Good point!
I decided to use RubyVM::AbstractSyntaxTree
because it's included MRuby and doesn't require additional dependencies. One option would be to make prototype
commands an external library and uses parser
gem (or something else if exists.)
because it's included MRuby
You mean CRuby, right? I think MRuby doesn't have RubyVM
.
One option would be to make
prototype
commands an external library and usesparser
gem (or something else if exists.)
Right, I think that would make sense.
I think moving and stabilizing AbstractSyntaxTree
would also be valuable, it seems a few gems decided to use RubyVM::AbstractSyntaxTree
but do not realize this is making the gem not portable across Ruby implementations, and using something experimental and unstable. (Just moving under ExperimentalFeatures
would also be an option if not making it stable at the same time)
Oh sorry, I mixed CRuby and MRI...
It's great to me too if AbstractSyntaxTree
is stable and portable.
I think showing a better error message and exit gracefully is the first step we can do now.
I don't think printing error messages is the best solution for this. Contributions for improvement are welcome.
Could we leave the issue opened?
The error message is an improvement but the original issue is still there: rbs prototype
only works on CRuby.
I posted a comment related to this on the RubyVM::AbstractSyntaxTree
on the CRuby tracker: https://bugs.ruby-lang.org/issues/14844#note-25
Okay. Reopening this issue. (I don't think I have bandwidth to do this for a while, but someone else would have!)
FYI, a report about this on the truffleruby tracker: https://github.com/oracle/truffleruby/issues/2691
Hello, it seems that currently
rbs
usesRubyVM::AbstractSyntaxTree
in a couple places: https://github.com/ruby/rbs/search?q=RubyVM&unscoped_q=RubyVMHowever, RubyVM by design is MRI-only and is expected to not exist as a constant on alternative Ruby implementations (documentation).
Do you plan to address this somehow? If
AbstractSyntaxTree
is needed byrbs
then I think it's time to move it somewhere outside ofRubyVM
.For instance, when running on TruffleRuby:
cc @bjfish
Relates to https://github.com/oracle/truffleruby/issues/1671