News: Stay up to date

The Étoilé community is an active group of developers, designers, testers and users. New work is being done every day. Visit often to find out what we've been up to.


Smalltalk Workspace and other LanguageKit News

Posted on 4 January 2010 by David Chisnall

It's been a while since I talked about LanguageKit, so I'd like to take this opportunity to introduce a few new features. One is an improvement to error reporting. Previously, warnings were sent to the standard error, while errors were reported via an exception.

These were fine for the command-line compiler tool, but not very flexible. One thing that I've been meaning to do for ages, and which I finally did just before Christmas, was to factor this out into a delegate. All errors and warnings are now sent to the delegate. This lets you do some quite nice things, including repair the AST without reparsing. More on this later.

The other nice new feature is something that I did almost none of the work for: an interpreter. LanguageKit includes JIT and static compilation already, but interpreting has a few advantages over these approaches. If you only run a statement once, a slow interpreter is still faster than compiling and optimising the statement. The interpreter is very useful for development, because you can trivially change the code in an interpreter, for example. Eric wrote most of the interpreter code. Unlike the compiler, the interpreter runs on Cocoa, as well as GNUstep.

In future, I plan on incorporating profiling into the interpreter and JIT compiler. We can then transparently recompile code based on profiling information. This includes things like speculative inlining, which the new runtime makes possible.

Eric's combined these two features to create something new; a Smalltalk Workspace. This is a feature that most Smalltalk implementations have. You can type Smalltalk statements into a window, select them, and run them. You can now do that in Étoilé. Currently, this uses the interpreter. In future, things like blocks will automatically be JIT compiled if they are executed more than a few times.

If you want to play with it, you'll need the latest LanguageKit svn and the SmalltalkWorkspace from Developer/Services in svn. If you use ETTranscript for output, as most of the example scripts do, then you'll notice that it works correctly with the workspace, redirecting the output to the window, rather than sending it to the terminal. The -log method on objects still goes to the standard error.