[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] Re: Starting with smalltalk

From: Paolo Bonzini
Subject: [Help-smalltalk] Re: Starting with smalltalk
Date: Mon, 03 Jul 2006 15:35:01 +0200
User-agent: Thunderbird (Macintosh/20060530)

(First of all, you may want to subscribe to address@hidden -- it is moderated for non-subscribers, so no spam).
I've been reading the GNU smalltalk manual, but the following I havn't
been able to find on the web yet:
- A GNU smalltalk compatible, functional program
You mean a program written with gst? Unfortunately I don't know of any :-( Mike Anderson has some on his blog, but they're small.
- A way of seperating smalltalk source over multiple files
You write the source code in multiple files, and then provide a loading script that loads them all (optionally saving everything to an image file, see later).
- A way of editing smalltalk files without the use of a commercial IDE
GNU Smalltalk has an Emacs mode.
- A way of running smalltalk probrams like other programs (from the
commandline) without the need of a wrapper script (The normal
'#!/usr/bin/env doesn't work, nor could i find ways of creating
You can use (with GNU Smalltalk 2.2)

#! /usr/bin/env gst -f


#! /bin/sh
"exec" "gst" "-f" "$0" "$@"

GNU Smalltalk special cases the #! at the beginning of a file as a one-line command. Comments are quote-delimited in Smalltalk, so the second line is eaten by GNU Smalltalk's parser in the second example.

In addition, GNU Smalltalk can save a snapshot of its status in an image (.im) file that can be made executable with chmod. Making something run automatically when the image file is reloaded is feasible. Just create a class-side method named #update: including some code like

update: aspect
   "Flush instances of the receiver when an image is loaded."
   aspect == #returnFromSnapshot ifTrue: [ self restart ]!

and then evaluate code like

   addDependent: NameOfTheClassWithTheUpdateMethod;
   snapshot: ''

Then, running gst with "gst -I" (or just making executable) will invoke the #restart method on the class NameOfTheClassWithTheUpdateMethod.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]