allegro-cl archives 1997-4-28 | home index prev H thread prev K thread next J next L |
From: S.N.K.Wat (Stuart Watt [at home]) Subject: Re: Problem (?) with evalhook Date: 1997-4-28 17:02 Actually, there isn't an interpreter at all in Allegro CL for Windows, and never has been. Many of the "smaller" (in fact, practically all non-UNIX) Common Lisp implementations don't have an interpreter, or a complete interpreter, at all. They simply compile the forms you type in and then run the code; eval simply calls compile. If the compiler's fast, the effect is still instant. CLtL2 makes strenuous efforts to ensure that it *doesn't* assume you've got a complete interpreter -- that's why all the stuff on constant folding is there. Code should work identically independent of whether it's compiled ot not, and this isn't possible with evalhook. Unfortunately, you can't implement evalhook sensibly without an interpreter, so I guess this just slipped through the net at the time, so I wouldn't count on its existence much. In fact, evalhook sometimes isn't all that useful anyway. This is because you can't actually do accurate stepping without knowing quite a lot about Common Lisp special forms. For example: (let ((a (+ 1 2)) (b (+ 1 2))) (+ a b)) There are two forms (+ 1 2), and they're both evaluated in the context of the let, but according to Common Lisp, there's no way of knowing which form is being evaluated on which call to evalhook. So writing any good stepper or tracer means you need to know all about how let works anyway, and evalhook hasn't helped much. Solutions? 1. Write a portable Common Lisp interpreter. I've been wanting to do this for years, but have never found the time. And somebody once told me (I think) it was voted out by ANSI. Anyway, if you really need a complete stepper, this is probably the only portable solution. 2. Use a code walker to "annotate" the forms before they are evaluated. There is a portable (ish) code walker at the CMU AI archive, which can probably be used for this. Tedious (a lot less tedious than 1 above) but viable. 3. Try to get the source code for the Allegro CL for Windows stepper, and adapt it. Not really ideal because it's not portable, but it may well work. Regards, Stuart |