Conditions and debugger support

Brian T Rice water at tunes.org
Thu Dec 4 01:05:21 PST 2003


I'm nearly ready to crank out the 0.2 release, so here's some follow-up:

On Tue, 2 Dec 2003, Brian T Rice wrote:

> We're cranking out a lot of changes recently. Here's condition/
> exception-handling support, all in Slate, improved a bit to work in the
> Smalltalk-ish frame of mind from what good bits that Dylan and Common Lisp
> had.

The Smalltalk ensure: method was added after this; we had been planning it
for a while, but just decided recently to do the simple thing and wrap the
equivalent Lisp function. For those who aren't familiar, ensure: is called
with two blocks. The first is executed, and the second is executed after
the first finishes or in /any/ case where control does not finish passing
through that body block. It's a very important feature.

> See src/condition.slate and src/debugger.slate for the source (not
> rocket science), and http://slate.tunes.org/progman/node21.html for some
> documentation (it's a tad out of date, handlerCase: is now handlingCases:,
> and there are a few more selectors worth knowing already).

I'll have updated the online copy of the manual soon.

> The debugger right now is simply a way to get a backtrace shown, with
> source file and line number information (the interpreter was already
> collecting this info), and to select a restart.

So that people are familiar with what we're presenting here, here's a
Slate image with an error immediately entered:

Slate 1> foo.
'src/debugger.slate':116 #interpretHook
'src/condition.slate':68 #handlingCases:
Primitive #ensure:
Primitive #saveImageNamed:
'src/debugger.slate':116 #interpretHook
'src/condition.slate':68 #handlingCases:
Primitive #ensure:
'src/condition.slate':304 #notFoundOn:

The following condition was signaled:
The method #foo was not found for the following arguments:
{<@Namespace:  traits lobby prototypes globals Mixins>}

The following restarts are available:
0)      Abort evaluation of expression
1)      Quit Slate
Debug [0..1]:

You type in a number, hit enter, and get the action. It's pretty simple,
but there can be more or fewer actions than just those two. You can ignore
interpreterHook and other such methods which show up in the stack; they're
just administrative interpreter hooks for debugging. That's all written in
Slate, too; you can tell from the slowness of the interpreted printing. :)

I have a more elaborate debugger in mind which should provide the ability
to inspect and travel much as the inspector, but that can wait for 0.2.1.

> Not everything is ready to ship, yet, though, but I'm making sure to fill
> out the error-handling parts of the SUnit port (src/test.slate) before 0.2
> goes.

SUnit now runs fine, although condition-handling's "abort" method seems to
back all the way out, so checking for errors causes SUnit to not complete.
With that said, the Slate port preserves the semantics quite well, and
handles errors competently.

> There is also support for image-saving under CLISP, and this is
> interacting a little oddly with the condition system, but the remaining
> glitch or two should be fixed really soon.

That support is "saveImageNamed: 'filename'.". CLISP loads it using
'clisp -M filename.mem'. I'm adding all this to the README.

What interaction problems there were with conditions have been worked out.

> Enjoy!

Many, many, many more bugs were fixed. Listing them out would duplicate
CVS contents, so I'll just briefly say that everything's been well-trodden
by now, and that unit-test contributions are welcome. ;) (Smalltalk has
quite a few that would port pretty easily.)

-- 
Brian T. Rice
LOGOS Research and Development
http://tunes.org/~water/



More information about the Slate mailing list