On Smalltalk

thoughts on Smalltalk and programming in general…
  • Home
  • About
  • Good Books
  • My Squeak Image
  • Popular Posts

New GNU Smalltalk Site Launched

By Ramon Leon - September 22, 2007 under Programming, Smalltalk

GNU Smalltalk has launched a new site. I thought it was about time to give it a try so I can write my shell scripts in Smalltalk. I work in Windows but I use Cygwin so I can have a real shell handy, fortunately GNU Smalltalk runs under Cygwin. So I fire up a shell and grab the latest version, unzip and untar it…

wget ftp://ftp.gnu.org/gnu/smalltalk/smalltalk-2.3.6.tar.gz
gunzip smalltalk-2.3.6.tar.gz
tar -xf smalltalk-2.3.6.tar

So far so good. The instructions say I need autoreconfig, so I fire up Cygwin setup and hit the Devel category and install it, just to be safe I install gcc compilers for C and C++ as well. Time to build Smalltalk (that sounds weird to me).

autoreconf -fvi
./configure
make

Takes a minute, checks a gazillion things, but all is well, build seems to work fine. Time to run the unit tests…

make check

Good to go, so lets install…

make install

OK, now just type “gst” to get a REPL, play around for a bit, and write my first simple shell script, a quick loop printing 1 to 10000 on stdout…

#!/usr/local/bin/gst -f
(1 to: 10000) do:[:it | it printOn: stdout].
!

Sweet, works like a charm. I can now fall back on Smalltalk for shell scripting instead of ruby or pearl when I need more power than simple bash scripts.

Stealing a sample from the Wiki shows a nice scripting syntax making use of blocks for declaring class and method bodies…

Object subclass: Person [
    | name age |
    Person class >> name: aString age: anInteger [
        ^(self new)
            name: aString;
            age: anInteger;
            yourself
    ]

    name [ ^name ]
    name: aString [ name := aString ]
    age [ ^age ]
    age: anInteger [ age := anInteger ]

    printOn: aStream [
        aStream << ('%1 (%2)' % {name. age})
    ]
]

I think I like it! Only time will tell, but I think this will be my new scripting language of choice.

Tags: Ruby, Smalltalk

Related posts
    at: "Simple File Based Application Configuration";
    at: "The Four Types of Web Developers";
    at: "Squeak Smalltalk Image Maintenance";

9 Comments so far

  1. The Smalltalk for those who can type < Iqag Notes on September 23rd, 2007

    [...] also have gnu-smalltalk-el packages with an Emacs major mode for your coding pleasure. [via On Smalltalk] Post a comment | Trackback [...]

  2. Paolo Bonzini on September 23rd, 2007

    The Person example only works in 2.95d (that’s where the new scripting syntax was developed).

  3. Ramon Leon on September 23rd, 2007

    Ah, OK, I went with the latest stable, but I guess I’ll load up the latest dev build when I want to play with the scripting syntax. In any case, it’s very cool to be able to write shell scripts in Smalltalk finally.

  4. Serge on September 24th, 2007

    A quick question from a complete newbie: does GST support regular expressions? What about regex literals? It would be tempting to migrate my stuff from Perl.

  5. Ramon Leon on September 24th, 2007

    It claims to, but you’d have to find out by experimenting. I’m just learning myself and know nothing of the basics.

  6. Sebastian on October 1st, 2007

    This is good news for me. Is very common to need to setup some backup mechanism in a linux server and the backup scripts are usually a mess or a syntax nightmare. Now the sun is starting to shine in shells too ;). I’ll certainly give a try on this one

  7. Ramon Leon on October 1st, 2007

    Yea, same feeling here, though I wish the database support were better.

  8. Dennis Draheim on October 1st, 2007

    I downloaded gst 2.95d and I’d like to play with the new subclassing syntax. Is it documented anywhere? I searched the wiki and can find references to the new syntax, and the one example, but no doc per se. In particular, I’m interested in how you’d define a class with instance, class, and/or class instance variables with this syntax.

  9. Ramon Leon on October 1st, 2007

    You’ll have to ask that question on the Wiki, I haven’t tried the new version yet.

Posting your comment.


  • Sponsors

  • Tags

    Databases General Linux Lisp Magritte Performance Profiling Programming Ruby Seaside Smalltalk Sql Squeak Updates
  • Categories

    • .Net (5)
    • Databases (9)
    • General (5)
    • Linux (2)
    • Lisp (3)
    • Magritte (2)
    • Programming (62)
    • Ruby (6)
    • Seaside (42)
    • Smalltalk (72)
    • Sql (2)
    • Stuff I Just Like (6)
    • Updates (7)
  • Blogs

    • (gem)Stone Soup
    • Avi Bryant
    • Boris Popov
    • defmacro
    • Giles Bowkett
    • Goran Krampe
    • James Robertson
    • Lukas Renggli
    • Martin Fowler
    • Paul Graham
    • Ralph Johnson
    • Randal Schwartz
    • Vassili Bykov
    • Weekly Squeak
  • Favorite Tools

    • Apache
    • Cygwin
    • FireFox
    • Scriptaculous
    • Seaside
    • Squeak
    • Squeak Dev Image
    • Ubuntu Linux
    • WordPress
  • Meta

    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org

Copyright © 2008 On Smalltalk