[pypy-svn] r29984 - pypy/extradoc/talk/dls2006
pedronis at codespeak.net
pedronis at codespeak.net
Wed Jul 12 16:22:54 CEST 2006
Author: pedronis
Date: Wed Jul 12 16:22:53 2006
New Revision: 29984
Modified:
pypy/extradoc/talk/dls2006/paper.tex
Log:
short discussion of RPython features vs Python, and an example of how RPython code is quite like idiomatic
Python.
Modified: pypy/extradoc/talk/dls2006/paper.tex
==============================================================================
--- pypy/extradoc/talk/dls2006/paper.tex (original)
+++ pypy/extradoc/talk/dls2006/paper.tex Wed Jul 12 16:22:53 2006
@@ -120,9 +120,44 @@
``restricted Python'' or RPython. This sublanguage is not restricted
syntactically, but only in the way it manipulates objects of different
types. The restrictions are a compromise between the expressivity and
-the need to statically infer enough type information to generate efficient code.
-The purpose of the translation tool-suite is to compile such
-RPython programs to a variety of different platforms.
+the need to statically infer enough type information to generate
+efficient code. RPython still supports inheritance but limited to
+single inheritance with some mix-in support, dynamic dispatch, to some
+extent keywords arguments and varargs, first-class function and class
+values, limited use of bound methods, runtime 'isinstance' and type
+queries, but no runtime reflection, further bindings in class and
+global namespaces are assumed constant. RPython code can be run on a
+Python interpreter without severe semantics mismatches, figure
+\ref{fig_create_frame} shows some RPython code from the
+\textit{Standard Interpreter}, it is still quite idiomatic Python code
+using the built-in dictionary type and first-class class values
+instantiation.
+
+\begin{figure}
+\begin{verbatim}
+ def get_frame_class(self):
+ # select the appropriate kind of frame
+ if not frame_classes:
+ setup_frame_classes() # lazily
+ choose = 0
+ if self.co_cellvars or self.co_freevars:
+ choose |= NESTED
+ if self.co_flags & CO_GENERATOR:
+ choose |= GENERATOR
+ Frame = frame_classes[choose]
+ return Frame
+
+ def create_frame(self, space,
+ w_globals, closure=None):
+ return self.get_frame_class()(space, self,
+ w_globals, closure)
+\end{verbatim}
+\caption{methods from Python bytecode class to instantiate frames.}
+\label{fig_create_frame}
+\end{figure}
+
+The purpose of the translation tool-suite is to compile such RPython
+programs to a variety of different platforms.
Our current efforts, and the present paper, focus on this tool-suite.
We will not describe the Standard Interpreter component of PyPy in the
More information about the Pypy-commit
mailing list