File under: development, Perl, Smalltalk, quine
Perl LiveObjects System
The worst parts of Perl, Self and SmallTalk mashed into one mindbending mess.
Also the largest known quine for Perl.
Download Perl + LiveObjects for Windows (119Mb)
Download just the Perl Code (20kb)
Smalltalk had many interesting features, one of the most notable was its "system image". Instead of keeping all its code in text files, smalltalk loads and saves an "image". The image is the entire running system. Source code, data, pointers, objects, everything. When you add new code, you add it to the running smalltalk image, and this gets dumped to disk when smalltalk quits. When you start Smalltalk again, it loads the image and you resume from where you left off.
This image is what gives smalltalk its amazing portability. To run it on a new system, you just have to port the part that loads the image and does the graphics. Nothing else has to change, because smalltalk is basically its own operating system. This is genuinely cool.
I decided I wanted this image ability in my favourite language, Perl. So I wrote Perl LiveObjects. Perl LiveObjects is a "save and restore" system that works in a similar way to smalltalk's image system. Perl can't actually save its memory representations directly, so I use some tricks to save as much as I can. The result is not quite an image system like smalltalk. Instead, it ends up being a collection of application objects that are saved and loaded. It doesn't save every part of the running system, but it does save the important parts and then restarts them again.
This version is a bit different in implementation. Instead of a class system, like Smalltalk, there is a Prototype system (like Self or Javascript). There is a list of System Prototypes, that can be cloned and modified. Objects tend to be "heavier" than usual, because Perl's excellent library system CPAN already provides most of the objects needed for a program. As a result, the objects in LiveObjects tend to focus on creating and managing these libarary objects.
This also fits the definition of a quine, so not only is this the largest quine I have seen so far, in Perl, it is also the only quine that I have seen which actually does something useful, as a consequence of being a quine.
Thesedays, I would have implemented this as a web application, using jQuery and BootStrap for the front end, and one of Perl's many excellent web frameworks for the backend. If I get a lot of free time, I might just do it. In addition, I would avoid saving everything to one file. It certainly makes it convenient to distribute, but it is a nightmare to debug. It is almost, but not quite, impossible to find an error in the image file that prevents it from booting. I would much rather have the objects saved into their own files, and some bootstrap code in its own file that I can debug using normal tools.