Cincom VisualWorks Smalltalk 25 years on

Return of the Living Dead

I don't want to be disparaging about this product, it was my favourite development environment for a long time. It could be astonishingly productive or completely, brutally time wasting depending on the programmer. After writing about it in the last post I figured I would see what it's like now and how it stacks up to modern environments like Android Studio or Visual Studio Code

Now, you can't just go and grab a copy of VisualWorks (I think, for a brief period in the 2000s they offered the community download no questions asked, but they don't any more). You make a polite request on their website, part of which I think is some vetting required for US export customers, not so different to downloading some of the embedded tools from Texas Instruments but still, it's some friction. I was allowed access to the download links (which were emailed to me) after 24 hours.

It...it hurts to be dead?

The download isn't an installer exactly, it's a CD image packaged as an ISO. On Windows 11, just right click and mount it and run "installWin.bat". On Debian, do the same thing although the script is "installUnix64". The windows install was fine. On Debian, the script failed to copy the "bin" directory to the local install directory for some reason I am too lazy to discern. No matter, a quick peruse of the script showed that doing a cp -r /media/smackeyacky/CST17PUL/bin /home/smackeyacky/vw8.3pul got everything out of that directory including stuff I don't need. On Windows, it creates a shortcut in your menu to start it, on Debian there is a script to run which annoyingly has a space right in the middle of the name: "VisualWorks Projects". I would rename that.

I can feel myself rot

First thing I want to do is feel that awesome sense of power that the right-click menu gave you in Smalltalk. "Do it" and "Inspect it" make everything about modern programming feel broken and sad. Like a massive backwards step was taken and the industry never returned to it. Sure, you can highlight an expression while you are debugging in IntelliJ or Visual Studio, but it isn't quite the same thing.

From the launcher (top left window) I click the "Workspace" icon and bring up a workspace. A workspace is kind of like a scratch pad, you can put snippets of code on it, right click them and they can be run ("Do it") or run and the results made available to browse ("Inspect it"). Time for the old classic:

Sure enough, the "Transcript" (which is the text on the launcher window) has the output of my snippet.

Hardly exciting you might think, but there is a lot going on in that little snippet of code. For starters, "Transcript" is a singleton object in the system you can inspect:

It's of type "TextCollector", and when you send it the message "show:" and pass it the object "'Hello World!'", it knows what to do with it (on the Inspector, click "Object->Browse" and it will bring up the class definition for TextCollector

Now if I use the browser and navigate to the instance method "show:" it will bring up the method implementation:

Which is fairly simple. The first line is the method signature. Note - there is no type given for the argument, the "aString" argument after the method name has no special meaning other than it's used as the reference for the first argument in the rest of the method. You can pass literally any object into "Transcript show:" and it will attempt to run it. In the method code itself, "self" is basically "this" in things like Java or C#, so the method is basically sending itself messages at this point. In the square brackets the expression "[self nextPutAll: aString]" is called a "block" in Smalltalk. Blocks are massively cool little chunks of code that are a little like lambda expressions in worse languages. You might miss the period (.) at the end of the block, probably the worst attribute of Smalltalk, it functions like a semi-colon in other languages completing the statement. In this case, the entire method boils down to "Grab my writeSequencer, tell it to enter a critical section (because I am multi-threaded), hand it some code to run once it has entered the critical section, the code block will tell myself to write all of this object 'aString'. Once that is done, end the critical section entry."

Well, now I'm intrigued because I want to know what the "nextPutAll:" method does. Not going to go into too many boring details but nextPutAll: expects a collection (which our ByteString is), grabs a reference to the internal stream that is owned by the Transcript and passes the string to that for another "nextPutAll:" and down the rabbit hole we go.

Don't jump to conclusions. Obviously, I didn't mean you were really dead. Dead people don't move around and talk.

You know what, it's good to be back. Next post I'm going to try to do something useful with VisualWorks - looking through the new Package Manager there are a lot of interesting things in there including an object-relational mapper called Glorp, all the networking stuff you will ever need (IMAP, HTTP, LDAP, web servers etc), regular expressions, Xpath, spell checkers. There is even a built in version control system which is a major step forward (although it looks like the back end runs on a database rather than on something like Git).

If you wanted to get a more immediate feel for Smalltalk then Pharo might be more accessible (home page for Pharo here) but I'm more familiar with VisualWorks so I'm going to plow on with it instead.

Postscript: what about the mac?

Well, the installer works just fine on an old Mac Mini (circa 2009) running El Capitan. So it's still truly cross platform.

Popular posts from this blog

Tailscale ate my network (and I love it)

Stupid stunts with WSL2 , Python3 and AWS ECS

Time machine: Solaris 2.6 on QEMU