[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]

's message of Fri, 17 Aug 90 15:13:26 AST <805@LNCC.BITNET>
Line-Fold: NO

   Date:     Fri, 17 Aug 90 15:13:26 AST
   From: Andre de Souza Mello Valente

       I am implementing a distributed version of CLOS, and I have
   some "silly" doubts about some implementation strategies and
   techniques. Maybe someone can help me and suggest a solution:

A general comment is that you should get a copy of PCL, which may
provide a useful starting point for your work.  PCL is a portable
implementation of (most of) CLOS.  It is available for free from
Xerox (by anonymous FTP).  For more information, send a message
to CommonLoops-Coordinator@parc.xerox.com.

      a) How can I intercept the CL evaluation to use my own
      dispatcher (the CLOS dispatcher, of course)? I thought
      about using eval-hook or apply-hook, but there are some
      problems. For instance, when you are using one of these
      functions and get an error, the interpreter make a throw
      that goes back to the interpreter top-level - and you should
      reinitialize to use the desired eval or apply again.

If you look in PCL, you will see a technique which just makes the
individual functions which are generic use a special dispatcher. 
At a lower level is an implementation of objects called funcallable 
instances.  These are functions which you can set the code of.

      b) How can I intercept the printing system to use the CLOS
      one (with "print-object")? We have to take care of two
      major possibilities: calling explicitly one of print, write,
      format, etc.; calling implicitly via the interpreter (in the
      read-eval-print cycle). Although it seems not, the second is
      very important because you have to print un-re-readable strings
      for the CLOS objects (#<...).

In large part, this isn't possible without the sources of the underlying
Common Lisp.  For objects defined by defstruct you can use
:print-function, but for most other things it is hard to get this to
work.  This is one the the things PCL doesn't support properly about

      c) How can I create the new versions of typep, type-of, etc.,
      using the older ones? I tried to create a new package and shadow
      the CL ones, but had no success. BTW, I tried the same with
      print, but got nothing also.

This is very hard to get completely right without access to the sources
from the underlying lisp.  PCL includes a version of this that works
mostly right, you should look at that.