More stuff about inferring the referential transparency of code

Partially for my own benefit so I can remember what to read about:

The developers of "E" (as in, the language at erights.org) propose a system of "auditors" which seems like a flexible way of adding new analysis tools to a language implementation. They propose a "Functional" auditor, which tells whether a particular piece of code is functional. I don't know if they've actually figured out how to do that (it's not clear from the article), but they're pretty smart guys. Notably, Ka-Ping Yee (aka "?!") is one of the authors.

Effect Systems (mentioned on lambda-the-ultimate) are apparently a way to annotate the *non*-functional portions of a program. I haven't really read anything about them yet, but they seem very relevant to the idea.

Functional optimizations with PyPy

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?

A day of mourning

From inthegroove.com: "News flash: Konami has acquired In The Groove"

In The Groove is the most innovative and fun dance game in the industry. The dinosaur that couldn't keep up, Konami, has harassed Roxor Games into handing it over to them. I don't know what the future of In The Groove as a game is; it is notable that the "buy the game" links on their web site have disappeared. However, it appears it is still available from the third party vendors that already have copies. For example, check out the ITG page on Play Asia.


I was just at the MC Frontalot concert here in Cambridge last night; he's one of the artists featured in the In The Groove games. It was a very good concert. Opening for him were Shael Riley and Optimus Rhyme. They were excellent.

Upgrading to Edgy

Ok, I upgraded to the pre-release of Edgy yesterday. Here are the problems so far:

  • Python 2.4.4 broke an interaction between Zope3 and Twisted (via changes to the 'cgi' module). Not a big deal, I only had to 'svn up' Zope3 to fix the problem (because Zope3 and Twisted developers already found the problem).
  • The button in my toolbar to start emacs broke, because this was the command in it: sh -c '. ~/.environment; /usr/bin/emacs-snapshot'. Apparently the default 'sh' in Edgy is now dash, which doesn't accept this syntax. I just changed it to 'bash' to get it to work.
  • Apparently my SMP support stopped working. Now a 'while 1: pass' loop in Python shows 100% CPU usage instead of 50%. I probably just have to apt-get the correct kernel to fix this, but I don't think I needed to do that when installing Dapper (although I may be mistaken). UPDATE: Apparently I was supposed to choose the "-generic" kernel from my bootup menu instead of the item that was selected by default and at the top of the menu, the "-386" one. UPDATE TWO: the -generic kernel didn't boot! I am going through ordeals. See bug 67256 on Launchpad. UPDATE THREE: Even after getting -generic to boot by regenerating my initrd, the nvidia drivers won't load. This might be solved soon. I don't know.
I'm not sure if any of these are bugs that ought to be filed, but I will investigate.

I am a School Student :-(

I'm about to start Japanese language classes at the Boston Language institute. Excitement!