Subject: [clisp-list] system function source

From: Elvin Peterson <[email-masked]>
Date: Thu Jul 29 07:47:02 2004

Hello,
  Is it possible to get the system function source in
clisp as in emacs?  I know that the function
"function" lists the source if it is not compiled
already.  Is it possible to prepare a binary which has
this property?

TIA.

__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail

---

From: Pascal J.Bourguignon <[email-masked]>
Date: Thu Jul 29 09:13:00 2004

Elvin Peterson writes:
> clisp as in emacs?  

Of course. Just check /usr/local/src/clisp-2.33.2/src/*.d

> I know that the function
> already.  

Actually, it's FUNCTION-LAMBDA-EXPRESSION. But this is an
implementation dependant feature and DISASSEMBLE too, for compiled
functions.

> Is it possible to prepare a binary which has
> this property?

Yes.  You could use an image where you've patched LOAD, COMPILE,
DEFUN, DEFMACRO and others  to make sure to keep the source lambda
expression in core, and in which you would have loaded the source of
the primitives (all these *.d files in /usr/local/src/clisp-2.33.2/src/),
along with a couple of functions to index and browse these sources.

But, emacs is an editor, clisp is not. It could be worthwhile to
incorporate an editor in clisp, I agree. Have a look at Portable
Hemlock (phemlock). http://www.stud.uni-karlsruhe.de/~unk6/hemlock/

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

There is no worse tyranny than to force a man to pay for what he does not
want merely because you think it would be good for him. -- Robert Heinlein

---

From: Sam Steingold <[email-masked]>
Date: Thu Jul 29 09:28:02 2004

> * Elvin Peterson <[email-masked]> [2004-07-29 07:46:13 -0700]:
>

this would be an enormous image bloat for little gain
(poor formatting, no comments &c).
get the sources and use emacs tags.

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.honestreporting.com>
UNIX is a way of thinking.  Windows is a way of not thinking.

---

From: Raymond Toy <[email-masked]>
Date: Thu Jul 29 10:01:01 2004

>>>>> "Sam" == Sam Steingold <[email-masked]> writes:

    >> already.  Is it possible to prepare a binary which has

    Sam> this would be an enormous image bloat for little gain
    Sam> (poor formatting, no comments &c).
    Sam> get the sources and use emacs tags.

Note, however, that cmucl and sbcl stores the source file and the form
number as debug information.  This allows the debugger to show the
actual form in the backtrace.  It also allows slime to jump directly
to the form when you ask it to.

This is very, very nice.

Ray

---

From: Sam Steingold <[email-masked]>
Date: Thu Jul 29 11:07:11 2004

> * Raymond Toy <[email-masked]> [2004-07-29 13:00:10 -0400]:
>

CLISP also stores the file name. (documentation 'foo 'sys::file) or something

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.honestreporting.com>
There is an exception to every rule, including this one.

---

From: Raymond Toy <[email-masked]>
Date: Fri Jul 30 07:51:45 2004

>> to the form when you ask it to.

    Sam> CLISP also stores the file name. (documentation 'foo 'sys::file) or something

What about the form?  Getting the file is good, but the form is what
makes it nice in the debugger, and especially nice in slime.

Ray

---

From: Sam Steingold <[email-masked]>
Date: Fri Jul 30 08:38:18 2004

> * Raymond Toy <[email-masked]> [2004-07-30 09:45:12 -0400]:
>
>     Sam> CLISP also stores the file name. (documentation 'foo
>     Sam> 'sys::file) or something
>

this is problematic: a single source form can produce several forms in
the FAS file.
I am not saying this is impossible, just that nobody volunteered to do
this and I don't use slime myself.

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.honestreporting.com>
186,000 Miles per Second.  It's not just a good idea.  IT'S THE LAW.

---

From: Raymond Toy <[email-masked]>
Date: Fri Jul 30 09:13:15 2004

>>>>> "Sam" == Sam Steingold <[email-masked]> writes:

    Sam> this is problematic: a single source form can produce several forms in
    Sam> the FAS file.

I don't know how cmucl does it, but it seems to have only the actual
source form.  Thus, macros aren't expanded (I think), which is pretty
handy.

    Sam> I am not saying this is impossible, just that nobody volunteered to do
    Sam> this and I don't use slime myself.

Slime's not required.  I find it quite handy in the debugger itself.
The debugger can show the form where the error occurred, and the form
from the caller's, all the way up the stack.  And it can show the
surrounding forms as well.  

Anyway, I find it very useful.  A nice project, I suppose, for someone
who wants to dig into clisp.

Ray