1 ;;;; miscellaneous side-effectful tests of CLOS
3 ;;;; This software is part of the SBCL system. See the README file for
6 ;;;; While most of SBCL is derived from the CMU CL system, the test
7 ;;;; files (like this one) were written from scratch after the fork
10 ;;;; This software is in the public domain and is provided with
11 ;;;; absolutely no warranty. See the COPYING and CREDITS files for
12 ;;;; more information.
18 ;;;; It should be possible to do DEFGENERIC and DEFMETHOD referring to
19 ;;;; structure types defined earlier in the file.
21 (defstruct struct-a x y)
22 (defstruct struct-b x y z)
24 (defmethod wiggle ((a struct-a))
27 (defgeneric jiggle ((arg t)))
28 (defmethod jiggle ((a struct-a))
31 (defmethod jiggle ((b struct-b))
36 (assert (= (wiggle (make-struct-a :x 6 :y 5))
37 (jiggle (make-struct-b :x 19 :y 6 :z 2))))
39 ;;; Compiling DEFGENERIC should prevent "undefined function" style warnings
40 ;;; from code within the same file.
42 (defgeneric gf-defined-in-this-file ((x number) (y number)))
43 (defun function-using-gf-defined-in-this-file (x y n)
45 (gf-defined-in-this-file x y)))
49 (sb-ext:quit :unix-status 104)