Feature #21826
openDeprecating RubyVM::AbstractSyntaxTree
Description
I think it is time to deprecate RubyVM::AbstractSyntaxTree.
Matz has agreed that going forward the official parser API for Ruby will be the Prism API so it's clear the official Ruby parsing API is the Prism API.
RubyVM::AbstractSyntaxTree is CRuby-specific and does not work on any other Ruby implementation, the API is unstable, inconvenient, etc:
This module is experimental and its API is not stable, therefore it
might change without notice. As examples, the order of children nodes is
not guaranteed, the number of children nodes might change, there is no
way to access children nodes by name, etc.
Because it's under RubyVM, it also has the following documented caveats:
This module is for very limited purposes, such as debugging, prototyping, and research.
Normal users must not use it. This module is not portable between Ruby implementations.
Given these caveats I think it could possibly be fair enough to remove it without deprecation,
however I see no urgency to remove it straight away so I think having it deprecated for one release is nicer for the few gems using it.
The advantages of deprecating it are:
- Make it clear that this API should not be used in new code
- Encourage the few usages to migrate to the Prism API, which is stable, officially supported, designed with many people to be usable and convenient for every parsing/tooling usage, etc.
- Improve portability of Ruby code between Ruby implementations
So, let's deprecate RubyVM::AbstractSyntaxTree in 4.1, and remove it in 4.2?
Updated by headius (Charles Nutter) 1 day ago
I am in favor, but that's no surprise.