July 08, 2002
Exploring CMUCL With ilisp

Thomas Burdick reveals how to make ilisp and cmucl to get along so that you can M-. (edit-definitions-lisp) your way to the source of built-in cmucl functions:


  ILISP has a command edit-definitions-lisp, bound by default to "M-.".

  CMUCL keeps track of which source file a function comes from, so ILISP

  can bring you to a function or variable or macro definition.  In the

  case of CMUCL's own source, the remembered location looks like:



    target:code/hash-new.lisp



  for example, the source file that the GETHASH definition comes from.

  This uses CMUCL's search-list extension, so you need to set the

  "target:" search-list, unless you happen to have the source in the

  same place as the person who built your CMUCL:



    * (search-list "target:")

    (#p"/net/dukas/l1/emarsden/CMUCL-18d-src/build/"

     #p"/net/dukas/l1/emarsden/CMUCL-18d-src/src/")

    * (setf (search-list "target:")

            (list #p"/opt/local/packages/cmucl-18d/src/"))

    (#p"/opt/local/packages/cmucl-18d/src/")



  Now you can type "(gethash", then M-. and get brought to the

  definition for GETHASH.  Very cool.

It's really handy sometimes to see how your lisp implements something. Handy, and often educational--not so much so that you can take advantage of implementation quirks or learn implementation limits, but as a way to become familiar with good lisp practices (we will assume that the people that write your lisp environment wrote mostly good code).

(It does seem like cmucl should be using a logical pathname host instead of a "search list" (which is not standard) for this. That's what MCL does. MCL comes with source for everything but the compiler itself, and M-. there taught me a lot when I was first starting out in lisp).

Posted by jjwiseman at July 08, 2002 01:14 AM
Comments

OpenMCL users can even look at the OpenMCL compiler. M-. in ILISP works for "everything" in OpenMCL. You may have/want to recompile OpenMCL to include all possible source information...

Posted by: Rainer Joswig on July 8, 2002 05:22 AM
Post a comment
Name:


Email Address:


URL:




Unless you answer this question, your comment will be classified as spam and will not be posted.
(I'll give you a hint: the answer is “lisp”.)

Comments:


Remember info?