Reputation: 1135
Is there a definitive specification for Ruby, akin to the Java Language Specification for Java. Googling ruby language specification provides http://ruby-std.netlab.jp/ as a result, but the site is down and i am not sure whether it is current
Upvotes: 24
Views: 5160
Reputation: 369428
There is a draft for a formal specification of Ruby. It is being developed by the Open Standards Promotion Center of the Information-Technology Promotion Agency (a Japanese government agency) for submission to the Japanese Industrial Standards Committee and then further on to the International Organization for Standardization.
However, nobody actually uses this specification. The specification that is actually being used is the directly executable RubySpec, which is used by all the major Ruby implementors like Rubinius, IronRuby, JRuby, MacRuby, MagLev and so on.
The three main differences between the ISO Draft Specification and RubySpec are:
Another great source (pun intended) of information about the behavior of Ruby is the source code of the Rubinius kernel, which implements the semantics of the Ruby language and the Ruby core library. (Note: a lot of people prefer the source code of YARV, but I don't, for two reasons: firstly, YARV is in C, which is a language that not every Rubyist knows, whereas Rubinius is in Ruby, which (hopefully) every Rubiyst knows, and secondly, the Rubinius codebase is much better structured, well-designed, well-organized, well-tested, well-documented.)
Upvotes: 16
Reputation: 13753
If you go to
https://docs.ruby-lang.org/en/2.6.0/syntax_rdoc.html
or
https://www.ruby-lang.org/en/documentation/
"The official Ruby API documentation"
https://docs.ruby-lang.org/en/
https://docs.ruby-lang.org/en/2.6.0/
then under 'pages' choose 'syntax'
Then you get this page, with its links to other relevant pages
https://docs.ruby-lang.org/en/2.6.0/syntax_rdoc.html
The Ruby syntax is large and is split up into the following sections:
Literals
Numbers, Strings, Arrays, Hashes, etc.
Assignment Assignment and variables
Control Expressions
if, unless, while, until, for, break, next, redo
Methods
Method and method argument syntax
Calling Methods
How to call a method (or send a message to a method)
Modules and Classes
Creating modules and classes including inheritance
Exceptions
Exception handling syntax
Precedence
Precedence of ruby operators
Refinements
Use and behavior of the experimental refinements feature
Miscellaneous
alias, undef, BEGIN, END
Upvotes: 0
Reputation: 383716
Ruby 1.8 has been the subject of several industry standards. The language specifications for Ruby were developed by the Open Standards Promotion Center of the Information-Technology Promotion Agency (a Japanese government agency) for submission to the Japanese Industrial Standards Committee (JISC) and then to the International Organization for Standardization (ISO). It was accepted as a Japanese Industrial Standard (JIS X 3017) in 2011[24] and an international standard (ISO/IEC 30170) in 2012.[25]
Upvotes: 11