Date

So, here's an idea: add a functionality inferencer to PyPy that decides whether some Python code is purely functional (doesn't contain any state-modification operations, doesn't access stuff that isn't passed to it or defined statically enough) -- or if you don't want to do that, just add a notation for declaring some code as purely functional. Then, you can disable the cyclic garbage collector for that code -- you can either just use refcounting, or use something way faster (there are tons of ways to optimize purely functional code, especially in garbage collection, like pointed out in this paper by Joe Armstrong and Robert Virding about real-time garbage collection). You can do this because it's impossible for functional code to create cyclic data structures (unless they use some sort of lazy evaluation, which doesn't really affect these optimizations). So frames created for this function can tell the cyclic garbage collector to go away, and any objects that that function creates don't need to take part in the cyclic garbage collector.

If you think that's crazy, you can also take a look at Use-Once-Variables, an idea for adding "linear objects" to non-linear languages (pretty much all programming languages are non-linear). Use-once-variables refer to linear objects, which can only ever have one reference at a time. Copying and deletion both require explicit support from the linear object. It definitely changes your style of programming to use linear objects, but they can offer some serious improvements to the ability to reason about code that uses them, not to mention that you can optimize the crap out of them.

The intuition behind linear types is the conservation of physical matter--a linear object cannot be created or destroyed without special permission, although it can be moved or transferred at will. Thus, an occurrence of a linear variable--e.g., in the argument list of a function call--indicates that the function will consume the value of the variable. If the function does not later return this value, either as a returned value, or by assigning it to a more global variable, then that function is responsible for properly disposing of any of the resources controlled by the value--even in the case of exceptions. -- Henry Baker, 'Use-Once' Variables

Alright. So PyPy is clearly the platform to implement these ideas on; what parts of the system need to be affected? Is it an object space? How many fundamental modifications does it require?