Wednesday, February 1, 2012

Smalltalk First Impressions

I've actually been meaning to get around to trying this out ever since the Dynamic Languages Smackdown[1].

So, I dusted off Pharo, which has had at least one major release since I last checked it out.

This time, I didn't pull punches, finding as many practical examples and tutorials to run through as I could. This includes two for Seaside[2], the couple for Pharo proper, and a built-in tutorial named ProfSteph which you can run from the greeting screen.

So here are my first impressions[3]; I'm sure they'll change as I learn more about the language (and I fully intend to learn more about it)

It Passes The Compaq Test

This thoroughly surprised me, because Smalltalk has a reputation for being brilliant and elegant but slow. I guess the people perpetuating this reputation mean "relative to C", because Seaside ran quite snappily off of a rather old machine with 256MB of ram. That was an "M". In fact, as I write this on that same ancient machine, I'm running Seaside in the background along with Slime and getting along perfectly well[4].

It Has "Source" Control

The word source is quoted because it's an image-based system, but a module called Monticello basically does for Smalltalk what git would do for other languages. I wouldn't mention this, except that I remember thinking about it last time, and several other people at the Smackdown expressed similar concerns. So if your main excuse for staying away from Smalltalk is "I don't want to give up source control", you no longer have an excuse.

Fantastic IDE

And this is coming from someone who usually hates IDEs. This one actually fails to get in my way at most opportunities, provides useful information and completions when I need them, is intuitive and well documented internally and externally, and (most importantly) does not take longer than Emacs to load up[5]. For those of you working cross-platform, it's also fully skinnable and comes with themes appropriate for the big three OSes (each of which it runs on beautifully).

Turtles All The Way Down

Everything is an object. Everything is an object. Signs of this show up in the way loops and conditionals are treated, as well as the complete construction of the system[7]. It's kind of an extension of the previous point, but I wanted to emphasize it. That fantastic environment I mentioned? It's built in Smalltalk. The main click-menu (called the World Menu) is actually represented in the image. You can head over to the class browser and find a class called TheWorldMenu. You can also Ctrl + right-click on any component of the menu to activate its halo and fuck with internal variables. You probably shouldn't, but you could. This level of introspection happens for almost[6] every component and sub-component you can see. I imagine this is what it would feel like to work on a full-out lisp machine.

Great GUI Toolkit

I reserve the right to change my mind since I've only gone through some very basic activities, but it looks like it would be very easy to put together desktop applications with Smalltalk. I'm not super clear on how you'd go about deploying them, but there seem to be ways.

That's the stuff that's attracted me. There's downsides too, of course, but they're not enough to give me pause. If you're just looking for an excuse not to try Smalltalk out, one of these should probably be enough.

No Respect for BEDMAS

All of the manuals are quite explicit about this too; the fact that everything is an object means that the expression 3 + 5 * 2 isn't actually an expression. It's two binary messages being sent to two SmallIntegers. That means that the only reasonable way to be consistent about it is to treat arithmetic strictly from the left; so that the expression above will actually evaluate to 16 rather than the expected 13 if you try it out.


This may actually be a pro for some people, but it's not for me. The environment expects you to do most things with the mouse[8]. There's a greater than usual amount of time spent dealing with objects and widgets, so I guess that might be fair, but look. If your window system doesn't let me move between windows without reaching for the rat, you're doing something wrong. Being already used to a tiling WM just makes it that much more annoying[9]. A lot of things have keyboard shortcuts, but not everything, and those things that don't are quite annoying. Not exactly annoying enough to jump over to GNU Smalltalk, but still.

Odd Choice of String Delimiters

In Smalltalk "foo" is not the string foo. It's actually the comment foo. The string foo looks like 'foo'. How do you put an apostrophe in a string? You don''t. You either escape it with a second quote, or you use typographers’ quotes. Now you know. I'm still not entirely sure why this decision was made though. It seems like pretty much any other comment delimiters would have made more sense.

Wonky Keyboard Shortcuts

I'm putting this one at the bottom of the list because I'm convinced that there must be a way to change them that I just haven't discovered yet. By "wonky", I don't mean "it uses the wrong letter", I mean "who the fuck thought this was the correct behavior?". Things like not having Ctrl+backspace backward-word-kill (giving that honor to Shift+backspace for comical effect), or having Ctrl+x kill a line, but move forward doing it and keep the \n in place, or having Ctrl+Right move forward a word, but skip newlines so that moving your point to the last symbol of a line is just that little bit more annoying. Also in this category, things like having (, ' and " auto-close themselves, but only about half the time and with a noticeable delay. Like I said, this isn't that huge a deal because I'm convinced that

  • There must be options I'm missing that will let me fix this
  • Even if there is no explicit config option, there's a way to fix this through the object model, and it won't be complicated enough to drive me to drink

So there. That's first impressions after about half a week of poking at Pharo. Hopefully it came off as more positive than negative, because I really do like the language so far, but my internal censor goes a bit wonky at about 11:00, and I won't get a chance to proof this until tomorrow morning.


1 - [back] - And now I'm shocked because I could have sworn it wasn't more than a year ago, but here we are.

2 - [back] - Though the official Seaside tutorial has some issues with registering new handlers, in Pharo at least. They tell you to go the web-interface route, which consistently ignored my brilliant HelloWorld handler. Check the sidebar for links to working tutorials ("Seaside 3.0 in Pharo" actually gives you a working tour as of this writing).

3 - [back] - Which differ from Preliminary Impressions in that they're founded on something more than gut feeling.

4 - [back] - Though I will admit that squeak is at the top of top by using a whopping 6%-8% of my CPU and 10%-16% of my memory.

5 - [back] - I'm looking at you, Eclipse. Though, to be fair, it's been a while, I guess you may have lost weight since then.

6 - [back] - It does tell you to fuck off if you try to add a halo to a halo component. I'm assuming I have to edit that directly through the class editor rather than at the front end.

7 - [back] - It's not cumbersome, though, every command I've typed so far has been extremely elegant, if alien (though that's just because I'm not used to it).

8 - [back] - In fact, it advises you to go get a three-button mouse if you don't have one already.

9 - [back] - Though I'm sure it must be possible to build one for the VM in such a way that you can easily strip it from your final product; I may look into this once I get my bearings. Edit: Nevermind. Though it might still be a good learning exercise.


  1. Hi, Pharo user here.

    Very nice article, it's good to know Pharo is having a first-sight positive impact!

    Agree 100% with you in regards to mouse and keyboard issues, although they are being addressed by some people in the community. See the following links:


    *Key Binding*

    *Ratless navigation*

    The latest is the first tool I installed when I first tried Squeak in 2008. Right now I got used to Pharo's shortcuts and I don't use it anymore, but it was a very nice thing to have to avoid being forced to touch the nasty rat ;)

    1. Cool. I actually found the TilingWM project already, but didn't know about the rest of those. Thank you! They all sound quite interesting. I'll have to play around with them once I get back to it.

  2. I see from the sidebar you do web development. You might like to try out Seaside...

    1. Whoops. I got distracted by kids before a replied. I read again and see you've already tried Seaside. Apologies for the noise.

    2. Heh. Don't worry about it. I appreciate the recommendation in any case; it really looks like an interesting web framework.