Next Previous Up Top Contents Index

4 The Trace Facility

4.4 Tracing methods

You can also trace methods (primary and auxiliary) within a generic function. The following example shows how to specify any qualifiers and specializers.

1. Type the following methods into the listener:
(defmethod foo (x) 
  (print 'there))

(defmethod foo :before ((x integer))
  (print 'hello))

2. Next, trace only the second of these methods by typing the following definition spec.
(trace (method foo :before (integer)))

3. Test that the trace has worked by calling the methods in the listener:
CL-USER 226 > (foo 'x)

THERE 
THERE

CL-USER 227 > (foo 4)
0 (METHOD FOO :BEFORE (INTEGER)) > (4)

HELLO 
0 (METHOD FOO :BEFORE (INTEGER)) < (HELLO)

THERE 
THERE

CL-USER 228 > 

LispWorks User Guide - 14 Oct 1998

Next Previous Up Top Contents Index

Generated with Harlequin WebMaker