The Essence of Ruby

  • Katsuhiro Ueno
  • Yutaka Fukasawa
  • Akimasa Morihata
  • Atsushi Ohori
Part of the Lecture Notes in Computer Science book series (LNCS, volume 8858)


Ruby is a dynamic, object-oriented language with advanced features such as yield operator and dynamic class manipulation. They make Ruby a popular, highly productive scripting language, but they also make the semantics of Ruby complicated and difficult to understand. Even the JIS/ISO standard of Ruby seems to contain some ambiguities. For Ruby to be established as a reliable scripting language, it should have a rigorous semantics. To meet this challenge, we present a formal operational semantics that can serve as a high-level specification for both the users and implementers. The key insight underlying the semantics is that various elaborate features of Ruby can be cleanly represented as a composition of two orthogonal calculi: one for objects and classes and the other for representing control. The presented semantics leads straightforwardly to a reference implementation. Initial evaluation of our implementation confirms that the presented semantics conforms to commonly accepted Ruby behavior.


Ruby operational semantics iterator dynamic language 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Abadi, M., Cardelli, L.: A Theory of Objects. Springer, Heidelberg (1996)CrossRefzbMATHGoogle Scholar
  2. 2.
    An, J.-H., Chaudhuri, A., Foster, J.S.: Static typing for Ruby on Rails. In: IEEE/ACM International Conference on Automated Software Engineering, pp. 590–594 (2009)Google Scholar
  3. 3.
    An, J.-H., Chaudhuri, A., Foster, J.S., Hicks, M.: Dynamic inference of static types for Ruby. In: ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 459–472 (2011)Google Scholar
  4. 4.
    Furr, M., An, J.-H., Foster, J.S.: Profile-guided static typing for dynamic scripting languages. In: ACM SIGPLAN Conference on Object Oriented Programming Systems Languages and Applications, pp. 283–300 (2009)Google Scholar
  5. 5.
    Furr, M., An, J.-H., Foster, J.S., Hicks, M.: The Ruby intermediate language. In: Symposium on Dynamic Languages, pp. 89–98 (2009)Google Scholar
  6. 6.
    Furr, M., An, J.-H., Foster, J.S., Hicks, M.: Static type inference for Ruby. In: ACM Symposium on Applied Computing, pp. 1859–1866 (2009)Google Scholar
  7. 7.
    Guha, A., Saftoiu, C., Krishnamurthi, S.: The essence of JavaScript. In: D’Hondt, T. (ed.) ECOOP 2010. LNCS, vol. 6183, pp. 126–150. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  8. 8.
    ISO/IEC 30170:2012, Information technology – Programming languages – Ruby (2012)Google Scholar
  9. 9.
    James, R.P., Sabry, A.: Yield: Mainstream delimited continuations. In: Workshop on the Theory and Practice of Delimited Continuations, pp. 20–32 (2011)Google Scholar
  10. 10.
    JIS X 3017:2011, Programming languages – Ruby (2011)Google Scholar
  11. 11.
    Kahn, G.: Natural semantics. In: Brandenburg, F.J., Vidal-Naquet, G., Wirsing, M. (eds.) STACS 1987. LNCS, vol. 247, pp. 22–39. Springer, Heidelberg (1987)CrossRefGoogle Scholar
  12. 12.
    Maffeis, S., Mitchell, J.C., Taly, A.: An operational semantics for JavaScript. In: Ramalingam, G. (ed.) APLAS 2008. LNCS, vol. 5356, pp. 307–325. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  13. 13.
    Milner, R., Tofte, M., MacQueen, D.: The Definition of Standard ML. MIT Press (1997)Google Scholar
  14. 14.
    Politz, J.G., Martinez, A., Milano, M., Warren, S., Patterson, D., Li, J., Chitipothu, A., Krishnamurthi, S.: Python: the full monty. In: ACM SIGPLAN International Conference on Object Oriented Programming Systems Languages and Applications, pp. 217–232 (2013)Google Scholar
  15. 15.
    Ruby programming language,

Copyright information

© Springer International Publishing Switzerland 2014

Authors and Affiliations

  • Katsuhiro Ueno
    • 1
  • Yutaka Fukasawa
    • 1
  • Akimasa Morihata
    • 1
  • Atsushi Ohori
    • 1
  1. 1.Research Institute of Electric CommunicationTohoku UniversityJapan

Personalised recommendations