File: mop-15.impure-cload.lisp

package info (click to toggle)
sbcl 1%3A0.9.16.0-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 19,960 kB
  • ctags: 16,537
  • sloc: lisp: 231,164; ansic: 19,558; asm: 2,539; sh: 1,925; makefile: 308
file content (48 lines) | stat: -rw-r--r-- 1,275 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
;;;; miscellaneous side-effectful tests of the MOP

;;;; This software is part of the SBCL system. See the README file for
;;;; more information.
;;;;
;;;; While most of SBCL is derived from the CMU CL system, the test
;;;; files (like this one) were written from scratch after the fork
;;;; from CMU CL.
;;;;
;;;; This software is in the public domain and is provided with
;;;; absolutely no warranty. See the COPYING and CREDITS files for
;;;; more information.

;;; this file tests that FINALIZE-INHERITANCE behaves intuitively:
;;; that when FINALIZE-INHERITANCE is called on a class, it returns
;;; before subclasses are finalized.

(defpackage "MOP-15"
  (:use "CL" "SB-MOP"))

(in-package "MOP-15")

(defclass mop-15-class (standard-class) ())

(defmethod validate-superclass ((s mop-15-class) (super standard-class))
  t)

(defvar *count* 0)
(defvar *max-count* 0)

(defmethod finalize-inheritance ((c mop-15-class))
  (let ((*count* (1+ *count*)))
    (when (> *count* *max-count*)
      (setf *max-count* *count*))
    (call-next-method)))

(defclass sub (super)
  ()
  (:metaclass mop-15-class))

(defclass super ()
  ()
  (:metaclass mop-15-class))

(finalize-inheritance (find-class 'super))
(finalize-inheritance (find-class  'sub))

(assert (= *max-count* 1))