Partitioning of Python

I'd like to see a form of "partitioning" added to Python, with three successive stages:
  1. Safe threads. Only immutable (or otherwise thread-safe) objects can be shared between threads. No longer a need to define a "memory model" (unless CPython and Java.)
  2. Dynamic code seclusion. Modules loaded at runtime prevented from affecting statically loaded code, thus ensuring a compiler can always perform intense optimizations.
  3. Untrusted code jailing. Prevent direct access to the OS or filesystem, as well as limiting memory and CPU usage.
Each stage would add a significant application domain:
  1. SMP. Threads can safely and easily run on multiple CPUs, or even on a cluster of CPUs
  2. Optimizing compilers performing global analysis. Mathematical applications, 3D graphics. Kernels anyone?
  3. Webbrowser applets, extra layer to trusted code security. Alternative to hardware address spaces?
One note, I believe sane finalization requires the first stage (safe threads), and since Python (or at least PyPy) requires finalization, it in turn requires safe threads.

No comments: