skip to main content
10.1145/1297081.1297091acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
Article

RPython: a step towards reconciling dynamically and statically typed OO languages

Published: 22 October 2007 Publication History

Abstract

Although the C-based interpreter of Python is reasonably fast, implementations on the CLI or the JVM platforms offers some advantages in terms of robustness and interoperability. Unfortunately, because the CLI and JVM are primarily designed to execute statically typed, object-oriented languages, most dynamic language implementations cannot use the native bytecodes for common operations like method calls and exception handling; as a result, they are not able to take full advantage of the power offered by the CLI and JVM.
We describe a different approach that attempts to preserve the flexibility of Python, while still allowing for efficient execution. This is achieved by limiting the use of the more dynamic features of Python to an initial, bootstrapping phase. This phase is used to construct a final RPython (Restricted Python) program that is actually executed. RPython is a proper subset of Python, is statically typed, and does not allow dynamic modification of class or method definitions; however, it can still take advantage of Python features such as mixins and first-class methods and classes.
This paper presents an overview of RPython, including its design and its translation to both CLI and JVM bytecode. We show how the bootstrapping phase can be used to implement advanced features, like extensible classes and generative programming. We also discuss what work remains before RPython is truly ready for general use, and compare the performance of RPython with that of other approaches.

References

[1]
C. S. Ananian. The static single information form. Technical Report MIT-LCS-TR-801, MIT Laboratory for Computer Science Technical Report, September 1999. Master's thesis.
[2]
C. Anderson, P. Giannini, and S. Drossopoulou. Towards type inference for javascript. In 19th European Conference on Object-Oriented Programming (ECOOP 2005), LNCS 3586, pages 428--453. Springer, 2005.
[3]
G. Bracha and W. Cook. Mixin-based inheritance. In ACM Symp. on Object-Oriented Programming: Systems, Languages and Applications 1990, volume 25(10) of SIGPLAN Notices, pages 303--311. ACM Press, October 1990.
[4]
G. Bracha, M. Odersky, D. Stoutamire, and P.Wadler. Making the future safe for the past: adding genericity to the Java programming language. In OOPSLA '98: Proceedings of the 13th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, pages 183--200, New York, NY, USA, 1998. ACM Press.
[5]
C. Clifton, T. Millstein, G. T. Leavens, and C. Chambers. MultiJava: Design rationale, compiler implementation, and applications. ACMTrans. Prog. Lang. Syst., 28(3), May 2006.
[6]
B. J. Cox. Object oriented programming: an evolutionary approach. Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA, 1986.
[7]
A. Cuni, S. Pedroni, A. Chrigström, H. Krekel, G. Wesdorp, and C. F. Bolz. High-level backends and interpreter feature prototypes. Technical Report D12.1, PyPy Consortium, 2007. http://codespeak.net/pypy/dist/pypy/doc/index-report.html.
[8]
S. Ducasse, O. Nierstrasz, N. Schärli, R. Wuyts, and A. P. Black. Traits: A mechanism for fine-grained reuse. ACM Trans. Program. Lang. Syst., 28(2):331--388, 2006.
[9]
ECMA. ECMA-335: Common Language Infrastructure (CLI). ECMA, Geneva (CH), third edition, June 2005.
[10]
C. Esterbrook. Using Mix-ins with Python. http://www.linuxjournal.com/article/4540.
[11]
E. Gamma, R. Helm, R. Johnson, and J. Vlissides. Design patterns. Elements of reusable object-oriented software. Addison-Wesley Professional, -c1995, 1995.
[12]
D. Ingalls, T. Kaehler, J. Maloney, S. Wallace, and A. Kay. Back to the future: the story of squeak, a practical smalltalk written in itself. In OOPSLA '97: Proceedings of the 12th ACMSIGPLAN conference on Object-oriented programming, systems, languages, and applications, pages 318--326, New York, NY, USA, 1997. ACM Press.
[13]
IronPython. http://www.codeplex.com/IronPython.
[14]
JRuby. http://jruby.codehaus.org/.
[15]
Jython. http://www.jython.org/.
[16]
S. Keene. CLOS and the Meta Object Protocol. Addison Wesley Publishing Company, 1989.
[17]
W. R. LaLonde and J. R. Pugh. Inside Smalltalk: vol. 1 and 2. Prentice-Hall, Inc., Upper Saddle River, NJ, USA, 1990.
[18]
C. Lattner and V. Adve. LLVM: A Compilation Framework for Lifelong Program Analysis & Transformation. In Proceedings of the 2004 International Symposium on Code Generation and Optimization (CGO'04), Palo Alto, California, Mar 2004.
[19]
T. Lindholm and F. Yellin. The JavaTM Virtual Machine Specification (2nd Edition). Prentice Hall PTR, April 1999.
[20]
P. Maes. Concepts and experiments in computational reflection. In OOPSLA '87: Conference proceedings on Object-oriented programming systems, languages and applications, pages 147--155, New York, NY, USA, 1987. ACM Press.
[21]
Martin Richards. Bcpl benchmark. http://www.cl.cam.ac.uk/~mr10/Bench.html.
[22]
E. Meijer and P. Drayton. Static typing where possible, dynamic typing when needed: The end of the cold war between programming languages. In OOPSLA'04 Workshop on Revival of Dynamic Languages, 2004.
[23]
Microsoft .NET. http://www.microsoft.com/net/.
[24]
Rhino. http://www.mozilla.org/rhino/.
[25]
A. Rigo, M. Hudson, and S. Pedroni. Compiling dynamic language implementations. Technical Report D05.1, PyPy Consortium, 2005. http://codespeak.net/pypy/dist/pypy/doc/index-report.html.
[26]
A. Rigo and S. Pedroni. PyPy's approach to virtual machine construction. In OOPSLA Companion, pages 944--953, 2006.
[27]
Slang. http://wiki.squeak.org/squeak/2267.
[28]
Sun Microsystems. JSR 292: Supporting dynamically typed languages on the Java platform. http://jcp.org/en/jsr/detail?id=292.
[29]
The Mono Project. http://www.mono-project.com.
[30]
C. to PyPy. http://codespeak.net/pypy/dist/pypy/doc/contributor.html.
[31]
G. Van Rossum. Unifying types and classes in Python 2.2. http://www.python.org/download/releases/2.2.3/descrintro/.

Cited By

View all
  • (2024)Unleashing quantum algorithms with Qinterpreter: bridging the gap between theory and practice across leading quantum computing platformsPeerJ Computer Science10.7717/peerj-cs.231810(e2318)Online publication date: 15-Oct-2024
  • (2024)Dr Wenowdis: Specializing Dynamic Language C Extensions using Type InformationProceedings of the 13th ACM SIGPLAN International Workshop on the State Of the Art in Program Analysis10.1145/3652588.3663316(1-8)Online publication date: 20-Jun-2024
  • (2024)Partial program analysis for staged compilation systemsFormal Methods in System Design10.1007/s10703-024-00458-xOnline publication date: 13-Jun-2024
  • Show More Cited By

Index Terms

  1. RPython: a step towards reconciling dynamically and statically typed OO languages

      Recommendations

      Comments

      Information & Contributors

      Information

      Published In

      cover image ACM Conferences
      DLS '07: Proceedings of the 2007 symposium on Dynamic languages
      October 2007
      108 pages
      ISBN:9781595938688
      DOI:10.1145/1297081
      Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

      Sponsors

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      Published: 22 October 2007

      Permissions

      Request permissions for this article.

      Check for updates

      Author Tags

      1. .NET
      2. JVM
      3. Python

      Qualifiers

      • Article

      Conference

      OOPSLA07
      Sponsor:

      Acceptance Rates

      Overall Acceptance Rate 32 of 77 submissions, 42%

      Upcoming Conference

      Contributors

      Other Metrics

      Bibliometrics & Citations

      Bibliometrics

      Article Metrics

      • Downloads (Last 12 months)35
      • Downloads (Last 6 weeks)10
      Reflects downloads up to 30 Dec 2024

      Other Metrics

      Citations

      Cited By

      View all

      View Options

      Login options

      View options

      PDF

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader

      Media

      Figures

      Other

      Tables

      Share

      Share

      Share this Publication link

      Share on social media