Is there a formal specification (like the Java Language Specification (JLS)) for Ruby?
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 by all the Ruby implementors like Rubinius, IronRuby, JRuby, MacRuby, MagLev and so on, is the RubySpec.
The three main differences between the ISO Draft Specification and RubySpec are:
- RubySpec is complete: it covers the entire Ruby language, and the entire core library, from version 1.8.7 to 1.9.2 and 1.9.3. The ISO Draft Specification only covers a very small subset of the intersection of 1.8 and 1.9.
- RubySpec is written in Ruby (which is a language that every Rubyist can read), the ISO Draft Specification is written in English, or rather in ISO Standardese (which is a language that only a handful of people on the planet can fully understand).
- RubySpec is executable: you can just run it against your Ruby implementation to see what you are still missing.
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.)
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]
References
- Wikipedia/Ruby (programming language)
See also
- ruby-std.netlab.jp - draft Ruby ISO standard
- ruby-standard.org - a wiki-format mirror of the draft Ruby ISO standard
- spec.ruby-doc.org - a community-driven project to write a complete, executable specification