Websela

Archive for September 2013

st72screen2

http://osrcon.ca/Squeak3.2.zip

http://www.squeakland.org/

http://wiki.squeak.org/squeak/989

At the Toronto Smalltalk Users Group last night I presented on the article The Early History Of Smalltalk by Alan Kay. You can Google it or buy a beautiful copy from the Digital Library at the ACM.

My intent was to see what Smalltalk was like without a compiler,  image, browser, or byte codes. The problem I’ve been facing for years is to look at the vm or byte codes or a CompiledMethod and not be able to look past the immediate context of what I’m looking at to see how it relates to other parts of the system.

I was intrigued by the part of the story where Dan Ingalls implemented the first interpreter in a Data General Nova in BASIC to make 3+4 tally. I thought why not do this in BASH? I found the St-72 simulator Dan made for the 3.2 image and that idea was quickly put aside. You can download the image above. You’ll need to use a vm from Squeakland. Then just read the instructions in the Transcript window.

Smalltalk-72 is very different from Smalltalk as we know it. It has no utility and is some kind of semiotics engine. The objective was to build better children with this medium of computing. Alan Kay talks about how he was influenced by Piaget, Bruner, and Papert. He’s not fooling around here. The difference between Smalltalk-72 and Smalltalk-76 cannot be overstated. If Dan Ingalls had not refused to “burn the disk packs” at the three day retreat in Pajaro Dunes in late January 1976, then you would never have heard of Smalltalk.  They went separate ways. Alan started work on NoteTaker. Dan came up with a new version of Smalltalk with byte level implementation that ran x180 faster and did work you as a programmer could appreciate. Alan came around when he saw the new system seven months later.

Even still, Smalltalk-72 is a blast. You can see the REPL from Lisp directly when you type “show ev” and it produces (repeat(cr read eval print)). That looks a lot to me like Interpreter>>#interpret. And Smalltalk-72 fits my agenda of wanting to see the interpreter in a simple, whole form that I can explore. All the pieces of future implementations are there in embryo. It’s great to be able to comprehend the whole system in the palm of my hand and then map it onto future evolutions.

Basically, you have an array called a vector that acts as the message stream. Vector understands the message eval. I won’t put the hash mark in front – # – because that wasn’t in use yet. At that time they used the “eyeball” or Celsius degree sign. So eval wound not be #eval but ˚eval. Get it? Eyeball. You send a message to vector and it “looks” to see if it understands that message. If it does then ˚eval would return true. True is the receiver of the new  message which is sent >> which is an if/than conditional. If the answer is true, then you execute the content in the vector (i.e. the selector in the compiled method) of this object. If the answer is false then it falls through and looks a the next selector token. It looks like this:

stScreen3

The object read has a message “of”. If ˚of evaluates to true, then the if/than conditional ˚>> will execute the code in the vector (:str. CODE 2). If the eyeball did not see the selector token name, then it returns false and the vector is passed over to check the next selector token. It helps to have a copy of the Smalltalk-72 Instruction Manual pdf, which isn’t hard to find.

Interestingly, David C. Smith of Croquet fame did his doctoral thesis at Stanford on Smalltalk-72 and “iconic programming”. He wrote a twenty page program called Pygmalion in 1975.

The Early History Of Smalltalk is a great read and the Smalltalk-72 interpreter is fun. It sort of makes you feel like a kid, which I suspect is its point. I mean, if you spend your time working on a system for children, then isn’t that a way of reminding yourself what it was like to be a child, because that’s a place you want to be?

At any rate, if the virtual machine is completely incomprehensible to you as it is to me, then the place to start is the interpreter. And a simple interpreter in the the Smalltalk-72 interpreter described in Appendix II of Alan’s article is a great place to start. The 60s live.

“Computer power to the people! Down with the cybercrud!”

Advertisements