[Squeakland] Scripting using Squeak

Ned Konz ned at bike-nomad.com
Mon Jun 30 14:03:59 PDT 2003

On Monday 30 June 2003 02:58 am, Roger McDermott wrote:

> I'm new to using Squeak so please forgive me if this question is
> off-track for this discussion forum.
> In the Squeak literature, there are reports of attempts to use
> Squeak for scripting purposes; I was wondering how it stacks up
> against the language Ruby which also purports to be a pure
> object-oriented language designed for this purpose? Does anyone
> have experience of using both languages?

Hi Roger,

Some of us have used both Squeak and Ruby.

The first question is: what do you consider a "scripting" language?

The second is: what do you want to use it for?

I like Ruby, and find myself using it for a number of  "glue" tasks. 
Still, Squeak is just as usable for some kind of scripting tasks as 

There are, however, assumptions in some parts of Squeak that you'll 
have a user interface, so there is code that will pop up confirmation 
or announcement dialogs when it shouldn't. This is a problem when 
you're running without a UI.

We're working (in Squeak 3.6) on making it possible to actually get 
the exceptions raised by such events and do something sensible with 
them. There has also been discussion about making a pluggable UI 
object for such interaction.

If you want to have a smoother scripting experience, here are some 

* Make a separate Squeak image for scripting. I'd recommend looking at 
3.6alpha, but 3.5 is OK too. Remove as much stuff from it as you can 
(many packages are now unloadable). I'd probably discard Morphic too 
if you're never going to need a user interface.

* Load the OSProcess package (assuming you are on a platform that 
supports it). This will give you better interaction with the 
operating system.

* Load the RegularExpression package to get full regular expressions.

* Turn on the Preferences that will keep the image from complaining 
about missing sources and changes files.

* Make sure that the Preference about loadDocumentAtStartup is set.

* Save the image.

* Make a shell script or batch file that will run this image and your 

squeak -headless myScriptingImage.image $1

Ned Konz

More information about the Squeakland mailing list