Monday, March 14, 2005

Another Reason Squeak/Smalltalk Is Cool

I was reading the Squeak Swiki tonight and ran across this entry for running headless. Here is the interesting bit:
    Another option is:
    Smalltalk snapshot: true andQuit: true.
    "All your restore stuff goes here"
    PWS serveOnPort: 80 loggingTo: 'log.txt'

    Select all of this and DoIt. Your image will save-and-quit...IN THE
    MIDDLE OF THE DOIT. When this image starts up, it continues the
    DoIt, which is the restore and the PWS startup.

Now, read through it. Does anything catch you off guard? Well, I for one think it's very clever! It takes into account that Smalltalk is a live system. You can quit in the middle of executing code and have it resume it where you left off when you quit! WOW! Name one modern IDE that can do that! It caught me off guard for its simplicity and cleverness. It again shows the absolute power that Smalltalk has. You can execute the code to save and quit the environment (because it's written in Smalltalk) and have it resume where you left off in your code if it was running! I had never thought of doing this! It makes me slap myself! I've saved images with running threads before (and have them jump back to life when the image restarts, this is how my background changer for Squeak works), and I don't know why I didn't think of it before. It's simply "a DUH! moment" TM.Anyway, I wanted to blog this because I thought it was another testament to the simplicity and power of Smalltalk. By the way, I think you can do this in any Smalltalk and it will work (the messages will vary by vendor of course).

No comments:

Amazon