This week I wrote a small video game (inspired by the famous boulder dash game) in rpython and used pypy to create an online version of the game out of it.
You can play the game here.
The sources can be found here.
The game as it is now is not really fun, but I only wrote it as an example of using pypy.
What I like with this approach is that I can develop in rpython, and even run the game using python interpreter, and only before I publish it use pypy to create the javascript version.
I could also create a C version using the same code for the game engine (only the graphic functions would have to be rewritten for each backends.)
This open the door to a lot of interesting applications.
On a side note, the pypy javascript translation is really not optimised. For example, let's try to guess what this generated function does :
function (){I don't want to spoil the fun of figuring this out by giving the answer...
var v1086,v1087,self_145;
var block = 0;
for(;;){
switch(block){
case 0:
self_144 = this;
self_145 = self_144;
block = 1;
break;
case 1:
v1086 = 'H';
block = 2;
break;
case 2:
return ( v1086 );
}
}
}