Feature #8892

Documentation of Ruby at the level of S-expressions.

Added by Boris Stitnicky 7 months ago. Updated 7 months ago.

[ruby-core:57123]
Status:Rejected
Priority:Normal
Assignee:-
Category:-
Target version:-

Description

Being a non-expert, I understood that Ruby is parsed into something like S-expressions. I am happy that Ruby allows me not to write in sexps. This buys ergonomy (code readability). I am also happy that Ruby allows me to write in sexps and even convert the sexp code to standard Ruby with tools such as Jim Weirich's Sorcerer. However, it seems to me that at the level of sexps, Ruby is underdocumented for us average users. I can only guess what :program, :stmts, :@int, :@float, :@ident etc. in Ripper.sexp output mean. Why not make the Ruby sexp documentation public?

History

#1 Updated by Yui NARUSE 7 months ago

  • Status changed from Open to Rejected

Why Ruby doesn't documantate its sexp is because we don't limit Ruby's future by its compatibility.

For version compatibility, Ruby's abstract syntax tree is internal expression and it may be changed suddenly.
If the syntax tree is published, people want the compatibility and it will limit future implementation.

For implementation compatibility, other than CRuby can use another internal expression for AST.
If the tree is published, the compatibility will disturb new parser implementations.

Anyway people can use AST as sexp with some gems or tools at their own risk.
This is considered the best situation.

#2 Updated by Yorick Peterse 7 months ago

If you want to use a parser with a stable and documented API use this
instead: https://github.com/whitequark/parser. Ripper isn't exactly a
breeze to work with.

Yorick

#3 Updated by Boris Stitnicky 7 months ago

@naruse: I see.
@yorickpeterse: Looks awesome. I hope it won't disappoint me. That whitequark guy looks amazing, too. Thanks for enlightening me.

Also available in: Atom PDF