Newsgroups: comp.lang.lisp.mcl
Path: cantaloupe.srv.cs.cmu.edu!rochester!cornellcs!travelers.mail.cornell.edu!news.tc.cornell.edu!newsserver.sdsc.edu!news.cerf.net!mvb.saic.com!news.mathworks.com!uhog.mit.edu!news!alanr
From: alanr@media.mit.edu (Alan Ruttenberg)
Subject: anonymous-not!.lisp
Message-ID: <1995Jul24.190915.23426@media.mit.edu>
Sender: news@media.mit.edu (USENET News System)
Cc: alanr-d
Organization: MIT Media Laboratory
Date: Mon, 24 Jul 1995 19:09:15 GMT
Lines: 51


I recently uploaded anonymous-not!.lisp to the contrib directory at
digitool. Anonymous-not! arranges to name local functions so that
their name becomes something which tells you where they were defined.

e.g.

(defun foo (a)
    (let ((a #'(lambda(f g) (bar f g)))
          (b #'(lambda() (biz))))
      (flet ((c () (fiz)))
        (funcall a b #'c))))

compiles to

0 (jsr_subprim $SP-ONE-ARG-VPUSH)
4 (vpush '#<Compiled-function (:lambda 1 :in foo) (Non-Global)
#x1124446>)
10 (vpush '#<Compiled-function (:lambda 2 :in foo) (Non-Global)
#x112429E>)
16 (vpush '#<Compiled-function (c :in foo) (Non-Global)  #x1124156>)
22 (move.l (vsp 4) d1)
26 (move.l @vsp d0)
28 (move.l (vsp 8) atemp0)
32 (set_nargs 2)
34 (jsr_subprim $SP-MVFPASS)
38 (jmp_subprim $SP-NVALRET)

Making it easier to debug than if the internal functions were named
"anonymous function".  Edit definition is patched so that when you
edit the definition of local function function, you are brought to the
source of the parent function. Finally, a few common macros are
rewritten so as to be easier to debug. e.g.

(defun draw-something (v)
    (with-focused-view v
      (foo)))

compiles to

0 (jsr_subprim $SP-ONE-ARG-VPUSH)
4 (vpush '#<Compiled-function (:with-focused-view-body :in draw-something) (Non-Global)  #x1126A46>)
10 (move.l (vsp 4) d1)
14 (move.l @vsp d0)
16 (set_nargs 2)
18 (move.l '#<call-with-focused-view Symbol Function Locative> atemp0)
24 (jsr_subprim $SP-MVPASS)
28 (jmp_subprim $SP-NVALRET)

-alan 
alanr-d@media.mit.edu
