Abstract
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.
The first author has been partially supported by JSPS KAKENHI Grant Number 24700021. The first and fourth author has been partially supported by JSPS KAKENHI Grant Number 25280019.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Abadi, M., Cardelli, L.: A Theory of Objects. Springer, Heidelberg (1996)
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)
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)
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)
Furr, M., An, J.-H., Foster, J.S., Hicks, M.: The Ruby intermediate language. In: Symposium on Dynamic Languages, pp. 89–98 (2009)
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)
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)
ISO/IEC 30170:2012, Information technology – Programming languages – Ruby (2012)
James, R.P., Sabry, A.: Yield: Mainstream delimited continuations. In: Workshop on the Theory and Practice of Delimited Continuations, pp. 20–32 (2011)
JIS X 3017:2011, Programming languages – Ruby (2011)
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)
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)
Milner, R., Tofte, M., MacQueen, D.: The Definition of Standard ML. MIT Press (1997)
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)
Ruby programming language, http://www.ruby-lang.org/en/
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2014 Springer International Publishing Switzerland
About this paper
Cite this paper
Ueno, K., Fukasawa, Y., Morihata, A., Ohori, A. (2014). The Essence of Ruby. In: Garrigue, J. (eds) Programming Languages and Systems. APLAS 2014. Lecture Notes in Computer Science, vol 8858. Springer, Cham. https://doi.org/10.1007/978-3-319-12736-1_5
Download citation
DOI: https://doi.org/10.1007/978-3-319-12736-1_5
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-12735-4
Online ISBN: 978-3-319-12736-1
eBook Packages: Computer ScienceComputer Science (R0)