Encountering Smalltalk-72 on the web

I found a version of Smalltalk-72 online through Gilad Bracha on Google+. It’s being written by Dan Ingalls, the original implementor of Smalltalk, on his relatively new web authoring platform called Lively Kernel (or Lively Web). I don’t know what Ingalls has planned for it, whether this will be up for long. I’m just writing about it because I found it an interesting and enlightening experience, and I wanted to share about it with others so that hopefully you’ll gain similar value from trying it out. You can use ST-72 here. I have some words of warning about it, as I’ll gradually describe in this post.

First of all, I’ve noticed as of this writing that as it’s loading up it puts up a scary “error occurred” message, and a bunch of “loading” messages get spewed all over the screen. However, if you are patient, all will be well. The error screen clears after a bit, and you can start using ST-72. This looks to be a work in progress, and some of it works.

What you’ll see is a white vertical rectangle surrounded by a yellowish box that contains some buttons. The white rectangle represents the screen area you work in. At the bottom of that screen area is a command line, which starts off with “Welcome to SMALLTALK.”

This environment was created using an original saved image of a running Smalltalk-72 system from 40 years ago. Even though the title says “ALTO Smalltalk-72,” it’s apparently running on a Nova emulator. The Nova was a minicomputer from Data General, which was the original platform Smalltalk was written on at Xerox PARC in the early 1970s. I’m unclear on what the connection is to the Alto’s hardware. You can even look at a Nova assembly monitor display by clicking on the “Show Nova” button, which will show you a disassembly of the machine instructions that the emulator is executing as you use Smalltalk. (To get back to Smalltalk, click on “Show Smalltalk.”) The screen display you see is as it was originally.

Smalltalk-72 is not the first version of Smalltalk, but it comes pretty close. According to Alan Kay’s retelling in “The Early History of Smalltalk,” there was an earlier version (which was the result of a bet he made with his PARC colleagues), but it was rudimentary.

This version does not run like the versions of Smalltalk most people familiar with it have used, which were based on Smalltalk-80. There are no workspace windows (yet), other than the command line interface at the bottom of the screen area, though there is a class editor (which as of this writing I’d say is non-functional). It doesn’t look like there’s a debugger. Anytime an error occurs, a subwindow with an error message pops up (which can be dismissed by pressing ctrl-D). You can still get some things done with the environment. To really get an idea of how to use it you need to click on “Open ST-72 Manual.” This will bring up a PDF of the original Smalltalk-72 documentation.

What you should keep in mind, though, (again, as of this writing) is that some features will not work at all. File functions do not work. There’s a keystroke the manual calls “‘s”, which is supposed to recall a specified object attribute, such as, for example, “title’s string” to access a variable called “string” out of an object called “title.” (“title” receives “‘s string” as separate messages (“‘s” and “string”), but “‘s” is supposed to be received as a single character, not two, as shown.) I have not been able to find this keystroke on the keyboard, though you can substitute a different message for it (whatever you want to use) inside a class.  The biggest thing missing at this point is that while it can read the mouse pointer’s position, this ST-72 environment does not detect any mouse button presses (the original mouse that was used with it had several mouse buttons). This disables any ability to use the built-in class editor, which makes using ST-72 a chore for anything more than “hello world”-type stuff, because besides adding a method to a class (which is easy to do), it seems the only way to change code inside a class is to erase the class (assign nil to its name), and then completely rewrite it. I also found this made later code examples in the documentation (which got more into sophisticated graphics) impossible to try out, as much as I tried to use keyboard actions to substitute for mouse clicks.

What I liked about seeing this version was it helped explain what Kay was talking about when he described the first versions of Smalltalk as “iconic” programming languages, and what he described with Smalltalk’s parsing technique, in “The Early History of Smalltalk” (which I will call “TEHS” hereafter).

To use this version, you’ll need to get familiar with how to use your keyboard to type out the right symbols. It’s not cryptic like APL, but it’s impossible to do much without using some symbolic characters in the code.

The most fascinating aspect to me is that parsing was a major part of how objects operated in this environment. If you’re familiar with Lisp, ST-72 will seem a bit Lisp-like. In fact, Kay says in TEHS that one of his objectives was to improve on Lisp’s use of “special forms” by making them unnecessary. He said that he did this by making parsing an integral part of how objects operate, and by making what appear to be syntactic elements (what would be reserved words or characters in other languages) their own classes, which receive messages, which are just other elements of a Smalltalk expression in your code; so that the parsing action goes pretty deep into how the whole system operates.

Objects in ST-72 exist in what I’d call a “nether world” between the way that Lisp functions and macros behave (without the code generation part). Rather than substitute bound values and evaluate, like Lisp does, it parses tokens and evaluates (though it has bound values in class, instance, and temporary variables).

It’s possible to create a class which has no methods (or just an implicit anonymous one). Done this way, it looks almost like a lambda (an anonymous function) in Lisp with no parameters. However, to pass parameters to an object, the preferred method is to execute some parsing actions inside the class’s code. ST-72 makes this pretty easy. Once you start doing it, using the “eyeball” character, classes start to look a bit like Lisp functions with a COND expression in it.

Distinguishing between using a class and an instance of it can be confusing in this environment. If you reference a class and pass it a message, that’s executing a class’s code using its class variable(s). (In ST-80 this would be called using “class-side code,” though in ST-72 the only distinction between class and instance is what variables inside the class specification get used. The code that gets executed is exactly the same in both cases.) In order to use an object instance (using its instance variable(s)), you have to assign the class to a variable first, and then pass your message to that variable. Assigning a class to a variable automatically creates an instance of the class. There is no “new” operator. The semantics of assignment look similar to that of SETQ in Lisp.

A major difference I notice between ST-72 and ST-80 is that in ST-80 you generally set up a method with a signature that lays out what message it will receive, and its parameter values, and this is distinct from the functionality that the method executes. In ST-72 you create a method by setting up a parsing expression (using the “eyeball” character) within the body of the class code, followed by an “implies” (conditional) expression, which then may contain additional parsing/implies expressions within it to get the message’s parameters, and somewhere in the chain of these expressions you execute an action once the message is fully parsed. I imagine this could get messy with sophisticated interactions, but at the same time I appreciated it, because it can allow a very straightforward programming style when using the class.

Creating a class is easy. You use the keyword “to” (“to” is itself a class, though I won’t get into that). If anyone has used the Logo language, this will look familiar. One of Kay’s inspirations for Smalltalk was Logo. After the “to”, you give the class a name, and enter any temporary, instance, and/or class variables. After that, you start a vector (a list) which contains your code for the class, and then you close off the vector to complete the class specification.

All graphics in ST-72 are done using a “turtle,” (though it is possible to use x-y coordinates with it to position it, and to direct it to draw lines). So it’s easy to do turtle graphics in this version of Smalltalk. If you go all the way through the documentation, you’ll see that Kay and Adele Goldberg, who co-wrote the documentation, do some sophisticated things with the graphics capabilities, such as creating windows, and menus, though since mouse button presses are non-functional at this point, I found this part difficult, if not impossible to deal with.

I have at times found that I’ve wanted to just start the emulator over and erase what I’ve done. You can do this by hitting the “Show Nova” button, hitting the “Restart” button, and then hitting “Show Smalltalk.”

Here is the best I could do for an ST-72 key map. Some of this is documented. Some of it I found through trial and error. You’ll generally get the gist of what these keys do as you go through the ST-72 documentation.

function keystroke description
! (“do it”) \ (backslash) evaluates expression entered on the command line, and executes it
hand shift-‘ quotes a literal (equivalent to “quote” in Lisp)
eyeball shift-5 “look for” – for parsing tokens
open colon ctrl-C fetch the next token, but do not evaluate (looks like two small circles one on top of the other)
keyhole ctrl-K peek at the input stream, but do not fetch token from it
implies shift-/ used to create if…then…else… expressions
return shift-1 returns value
smiley/turtle shift-2 for turtle graphics
open square shift-7 bitwise operation, followed by:
a * (number) = a AND (number)
a + (number) = a OR (number)
a – (number) = a XOR (number)
a / (number) = a left-shift by (number)
? shift-~ (tilde) question mark character
‘s (unknown)
done ctrl-D exit subwindow
unary minus
less-than-or-equal ctrl-A
greater-than-or-equal ctrl-Z
not equal ctrl-N
% ctrl-V
@ ctrl-F
! ctrl-Q exclamation point character
ctrl-O double quote character
zero(?) shift-4
up-arrow shift-6
assignment shift-_ displays a left-arrow, equivalent to “=” in Algol-derived languages.
temp/instance/class variable separator : (colon) (this character looks like ‘/’ in the ST-72 documentation, but you should use “:” instead)

When entering Smalltalk code, the Return key does not enter the code into the system. It just does a line-feed so you can enter more code. To execute code you must “do it,” by pressing ‘\’.

You’ll notice some of the keystrokes are just for typing out a literal character, like ‘?’. This is due to the emulator re-mapping some of the keystrokes on your keyboard to do something else, so it was necessary to also re-map the substituted characters to something else so they could still be used.

Using ST-72 feels like playing around in a sandbox. It’s fun seeing what you can find out. Enjoy.

This is one of a series of “bread crumb” articles I’ve written. To see more like this, go to the Bread Crumbs page.

Identifying what I’m doing

As I’ve been blogging here, there have been various issues that I’ve identified, which I think need to be remedied in the world of computing, though they’re ideas that have occurred to me as I’ve written about other subjects. I went through a period, early on in writing here, of feeling lost, but exploring about, looking at whatever interested me in the moment. My goal was to rediscover, after spending several years in college, getting my CS degree, and then several more years in professional IT services, why I thought computers were so interesting so many years ago, when I was a teenager. I had this idea in my head back then that computers would lead society to an enlightened era, a new plateau of existence, where people could try out ideas in a virtual space, the way I had experienced on early computers, with semi-interactive programming. I saw the computer as always being an authoring platform, and that the primary method of creating with it would be through programming, and then through various apparatus. I imagined that people would gain new insight about their ideas through this work, the way I had. I did not see this materialize in my professional career. So I decided to leave that world for a while. I make it sound here like it was a very clear decision to me, but I’m really saying this in hindsight. Leaving that world was more of a gradual process, and for a while I wasn’t sure I wanted to do it. It felt scary to leave the only work I knew as a professional, which gave me a sense of pride, and meaning. I saw too many problems in it, though, and it eventually got to me. I expected IT to turn out better than it did, to become more sane, to make more sense. Instead the problems in IT development seemed to get worse as time passed. It made me wonder how much of what I’d done had really improved anything, or if I was just going through the motions, pretending that I was doing something worthwhile, and getting a paycheck for it. Secondly, I saw a major shift occurring in software development, perhaps for the better, but it was disorienting nevertheless. I felt the need to explore in my own way, rather than going down the beaten path that someone else, or some group, had laid out for me.

I spent as much time as I could trying to find better ideas for what I wanted to do. Secondly, I spent a lot of time trying to understand Alan Kay’s perspective on computing, as I was, and am, deeply taken with it. That’s what this blog has largely been about.

When people have asked me, “What are you doing,” “What are you up to,” I’ve been at a loss to explain it. I could explain generically, “I’ve been doing some reading and writing,” “I’m looking at an old programming language,” or, “I’m studying an operating system.” They’re humdrum explanations, but they’re the best I could do. I didn’t have any other words for it. I felt like I couldn’t say I was wandering, going here and there, sampling this and that. I thought that would sound dangerously aimless to most of the people I know and love.

I found this video by Bret Victor, “Inventing on Principle,” and finally I felt as though someone put accurate, concise words to what I’ve been trying to do all this time.

His examples of interactive programming are wonderful. I first experienced this feeling of a fond wish come true, watching such a demonstration, when Alan Kay showed EToys on Squeak back in 2003. I thought it was one of the most wonderful things I had witnessed. Here was what I had hoped things would progress to. It was too bad such a principle wasn’t widespread throughout the industry. It should be.

What really excited me, watching Bret’s video, is that at 18 minutes in he demonstrated a programming environment that looks similar to a programming language design I sketched out last fall, except what I had in mind looked more like the “right side” of his interactive display, which showed example code, than the “left side.”

I was intrigued by an idea I heard Alan Kay express, by way of J.C.R. Licklider, of “communicating with aliens” as a general operating principle in computing. Kay said that one can think of it more simply as trying to communicate with another human being who doesn’t understand English. You can still communicate somewhat accurately by making gestures in a context. If I had to describe my sketch in concise terms, I’d call it “programming by suggestion.” I had a problem in mind of translating data from one format into another, and I thought rather than using a traditional approach of inputting data and then hard-coding what I wanted it translated into, “Why not try to express what I want to do using suggestions,” saying, “I want something like this…,” using some mutually recognizable patterns as primitives, and having the computer figure out what I want by “taking the hints,” and creating inferences about them. It sounds more like AI, though I was trying to avoid going down that path if I could, because I have zero skill in AI. Easier said than done. I haven’t given up on the idea, though as usual I’ve gone off on some other interesting diversions since then. I had an idea of building up to what I want from simpler system designs. I may yet continue to pursue that avenue.

I’ve used each problem I’ve encountered in pursuit of my technical goals as an opportunity to pursue an unexamined idea I consider “advanced” in difficulty. So I’m not throwing any of the ideas away. I’m just putting them on the shelf for a while, while I address what I think are some underlying issues, both with the idea itself, and my own knowledge of computing generally.

Bret hit it on the head for me about 35 minutes into his talk. He said that pursuing the way of life he described is a kind of social activism using technology. It’s not in the form of writing polemics, or trying to create a new law, or change an existing one. Rather, it’s creating a new way for computers to operate as a statement of principles. This gets to what I’ve been trying to do. He said finding your principle is a journey of your own making, and it can take time to define. I really liked that he addressed the issue of trying to answer the question of, “Why you’re here.” I’ve felt that pursuit very strongly since I was in high school, and I’ve gone down some dead ends since then. He said it took him 10 years to find his principle. Along the way he felt unsure just what he was pursuing. He saw things that bothered him, and things that interested him, and he paid attention to these things. It took time for him to figure out whether something was just interesting for a time, or whether it was something that fit into his reason for being. For me, I’ve been at this in earnest since 2006, when I was in my mid-30s, and I still don’t have a defined sense yet of what my principle of work is. One reason for that is I only started working along these lines a year and a half ago. I feel like a toddler. I have a sense of what my interest centers around, though; that I want to see system design improved. I’ve stated the different aspects of this in my blog from time to time. Still, I find new avenues to explore, lately in non-technical contexts.

I’ve long had an interest in what makes a modern civilization tick. I thought of minoring in political science when I was in college. My advisor joked, “So, you’ll get your computer science degree, and then run for office, eh?” Not exactly what I had in mind… I had no idea how the two related in the slightest. I ended up not going through with the minor, as it required more reading than I could stomach. I took a few poli-sci courses in the meantime, though. In hindsight, I was interested in politics (and continue to be) because I saw that it was the way our society made decisions about how we were going to relate and live with each other in a future society. I think I also saw it as a way for society to solve its problems, though I’m increasingly dubious of that view. That interest still tugs at me, though recently it’s drawn me closer to studying the different ways that humans think, and/or perhaps how we can think better, as this relates a great deal to how we conduct politics, which affects how we relate to/live with each other as a society. I see this as mattering a great deal, so it may become a major avenue as I progress in trying to define what I’m doing. I don’t see politics as a goal of mine anymore. It’s more a means for getting to other pursuits I am developing on societal issues.

When Bret talked about what “hurt” him to see, this focus on politics came into view for me. When I think about the one thing that pains me, it’s seeing people use weak arguments (created using a weak outlook for the subject) to advance major causes that involve large numbers of people’s lives, because I think the end result can only be misguided, and perhaps dangerous to a free society in the long run. When I see this I feel compelled to intervene in the discussion in some way, and to try to educate the people involved in a better way of seeing the issue they’re concerned about, though I’m a total amateur at it. Words often fail to explain the ideas I’m trying to get across, because the people receiving them don’t understand the outlook I’m assuming, which suggests that I either need a different way of expressing those ideas, or I need to get into educating children about powerful outlooks, or both. Secondly, most adults don’t like to have their ideas challenged, so their minds are closed to new ideas right from the start. And I’ve realized that while it’s legitimate to try to address this principle which I try to act on, I need to approach how I apply it differently. Beating one’s head against a wall is not a productive use of time.

It has sometimes gotten me reflecting on how societies going back more than 100 years degenerated into regimented autocracies, which also used terribly weak arguments to justify their existence, with equally terrible consequences. We are not immune from such a fate. Such regimes were created by human beings just like us. I have some ideas for what I can do to address this concern, and that of computing at the same time, though I feel I now have a more realistic sense of the breadth of the effect I can accomplish within my lifetime, which is quite limited, even if I were to fully develop the principles for my work. A way has already been paved for what I describe by another techno-social activist, but I don’t have a real sense yet of what going down that avenue means, or even if reconciling the two is really what I want to do. As I said, I’m still in the process of finding all this out.

Thinking on this, a difference between myself and Bret (or at least what he’s expressed so far) is that like Alan Kay and Doug Engelbart, I think I see my work in a societal context that goes beyond the development of technology. Kay has dedicated himself to developing a better way to educate people in the great ideas humans have invented. He uses computers as a part of that, but it’s not based in techno-centrism. His goal is not just to create more powerful “mind amplifiers” or media. The reason he does it is as part of a larger goal of creating the locus for a better future society.

I am grateful to Bret for talking so openly about his principle, and how he arrived at it. It’s reassuring to be able to put a term to what I’m trying to achieve.

Related posts:

Coding like writing

The “My Journey” series

Why I do this