Question

Do all Ruby interpreters follow the same Ruby syntax defined in www.ruby-lang.org?

  • MRI
  • YARV
  • Rubinius
  • JRuby
  • IronRuby

Cause it is the interpreter that defines the Ruby language. Does that mean one interpreter could add a feature/syntatic sugar that other interpreters haven't?

If that is the case, do all interpreters have their own API documentation?

Cause I'm using: http://ruby-doc.org/ruby-1.9/index.html.

Which interpreters are implementing that one?

Could someone shed a light on this topic.

Thanks!

Was it helpful?

Solution

Do all Ruby interpreters follow the same Ruby syntax defined in www.ruby-lang.org?

Yes, they all use the same syntax. In fact, they actually all use the same parser, or at least a parser that was automatically generated from the same source file.

Cause I'm using: http://ruby-doc.org/ruby-1.9/index.html.

Which interpreters are implementing that one?

At the moment, the only production-ready Ruby execution engine that implements Ruby 1.9 fully is YARV.

JRuby itself is production-ready, and it implements both Ruby 1.8.7 and Ruby 1.9.2, but the Ruby 1.9.2 implementation is not yet complete. IronRuby and Rubinius are also working on implementations of Ruby 1.9.2. MacRuby has a fairly complete Ruby 1.9 implementation, but it is still far from a 1.0 release. MRI doesn't implement Ruby 1.9 and probably never will.

But I don't understand why you are so concerned about the syntax. Syntax differences are trivial to spot: if there were a difference in the syntax, the engine would simply refuse to parse your file and you would know immediately that there is something wrong. Differences in semantics on the other hand are much more dangerous.

OTHER TIPS

Which bit of "syntactic sugar" are you referring to?

Keep in mind that ruby has a very small set of keywords. A lot of stuff that seems to be a keyword at first is actually implemented by Kernel (eg require, puts, and raise).

http://apidock.com/ruby/Kernel

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top