Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!dali.cs.montana.edu!caen!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!jpl-devvax!ai-cyclops.jpl.nasa.gov!charest From: charest@ai-cyclops.jpl.nasa.gov (Len Charest) Newsgroups: comp.lang.lisp Subject: shadowing defstruct print-function Message-ID: <1991May31.183953.29579@jpl-devvax.jpl.nasa.gov> Date: 31 May 91 18:39:53 GMT Sender: usenet@jpl-devvax.jpl.nasa.gov (For NNTP so rrn will be able to post) Reply-To: charest@AI-Cyclops.JPL.NASA.GOV Organization: NASA/Jet Propulsion Laboratory Lines: 16 Nntp-Posting-Host: ai-cyclops Is it possible to shadow the print-function used to print a structure during a call to FORMAT? For example, suppose we have a structure FOO that prints using the print-function PRINT-FOO, i.e.,: (format t "~a" foo) => # Now I want to locally redefine PRINT-FOO as in: (flet ((print-foo (foo stream depth) (declare (ignore foo depth)) (format stream "{Foo}"))) (format t "~a" foo)) => {Foo} execpt that FLET only has lexical scope and the ~a FORMAT directive calls PRINT-FOO at a nested level where the global definition is active. So # will really be printed. Any pointers? -- * Len Charest, Jr. charest@ai-cyclops.jpl.nasa.gov JPL Artificial Intelligence Group *