Issue #15743 has been updated by mame (Yusuke Endoh).


Eregon,

Thank you for your reply, but I'm not convinced yet.

> But we cannot, end users use whatever is available in MRI, including RubyVM. Some gems use RubyVM.

If you think so, you have to implement the feature in any way, regardles of whether it is renamed to CRuby or not?  I don't see at all what the renaming will solve.


> * RubyVM::InstructionSequence is a representation of the MRI/CRuby/YARV bytecode. I don't think we can reproduce this on e.g., TruffleRuby, where there is no Ruby bytecode involved.
> * RubyVM::AbstractSyntaxTree exposes the internal CRuby AST. I'm pretty sure other Ruby implementations have a slightly different AST while parsing. Ripper seems the portable version of this.

I believe that they can be implemented as compatibility layers.  For example, TruffleRuby's RubyVM::InstructionSequence can return a MRI-compatible bytecode, but TruffleRuby will not use the bytecode for execution.  I think that such a dummy API would be actually useful for some cases, e.g., MRI bytecode-level static analyzer.

You may think it is not worthy for implementation effort.  I agree.  So I think you can just ignore RubyVM module.

----------------------------------------
Bug #15743: RubyVM should be renamed to CRuby
https://bugs.ruby-lang.org/issues/15743#change-77467

* Author: Eregon (Benoit Daloze)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: Next Major
* ruby -v: ruby 2.6.2p47 (2019-03-13 revision 67232) [x86_64-linux]
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
My understanding is that `RubyVM` is supposed to only exist on MRI/CRuby, and not on any other Ruby implementation.
In fact, almost all features under `RubyVM` are not realistically implementable on other major Ruby implementations (JRuby, TruffleRuby, Rubinius).

Unfortunately, the name doesn't reflect that it is specific to CRuby, e.g., JRuby/TruffleRuby/Rubinius are also "Ruby VMs".
And as a result it is not clear for many Ruby users that RubyVM is CRuby-specific.

The documentation is also unclear:
```
The RubyVM module provides some access to Ruby internals. This module is
for very limited purposes, such as debugging, prototyping, and research.
 Normal users must not use it.
```

So I propose to rename RubyVM to CRuby.
That way, it is clear for everyone that this module is CRuby-specific.
It's also consistent with the JRuby module, the TruffleRuby module and the Rubinius module.

Proposed migration path:

* Introduce CRuby as an alias of RubyVM on `trunk`, and deprecate the RubyVM constant on `trunk` (for 2.7).
* Remove `RubyVM` in Ruby 3.0.

What do you think?

cc @ko1 @k0kubun @headius



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>