1 ;;;; This software is part of the SBCL system. See the README file for
4 ;;;; This software is derived from software originally released by Xerox
5 ;;;; Corporation. Copyright and release statements follow. Later modifications
6 ;;;; to the software are in the public domain and are provided with
7 ;;;; absolutely no warranty. See the COPYING and CREDITS files for more
10 ;;;; copyright information from original PCL sources:
12 ;;;; Copyright (c) 1985, 1986, 1987, 1988, 1989, 1990 Xerox Corporation.
13 ;;;; All rights reserved.
15 ;;;; Use and copying of this software and preparation of derivative works based
16 ;;;; upon this software are permitted. Any distribution of this software or
17 ;;;; derivative works must comply with all applicable United States export
20 ;;;; This software is made available AS IS, and Xerox Corporation makes no
21 ;;;; warranty about the software, its performance or its conformity to any
26 ;; This choice of naming structure is perhaps unfortunate, because were the
27 ;; names 2-lists, the globaldb hack to support this would instead be
28 ;; a natural use of the (SETF <x>) style naming that globaldb favors.
29 ;; But this naming is documented, and changing it would be incompatible.
30 ;; The 4-part name can be thought of as a 2-part name because
31 ;; half of it is composed of constants:
32 ;; (SB-PCL::SLOT-ACCESSOR :GLOBAL <foo> SB-PCL::{READER|WRITER|BOUNDP})
33 ;; -> ({READER|WRITER|BOUNDP} <foo>)
35 (defun slot-reader-name (slot-name)
36 (list 'slot-accessor
:global slot-name
'reader
))
38 (defun slot-writer-name (slot-name)
39 (list 'slot-accessor
:global slot-name
'writer
))
41 (defun slot-boundp-name (slot-name)
42 (list 'slot-accessor
:global slot-name
'boundp
))
44 ;;; This is the value that we stick into a slot to tell us that it is
45 ;;; unbound. It may seem gross, but for performance reasons, we make
46 ;;; this an interned symbol. That means that the fast check to see
47 ;;; whether a slot is unbound is to say (EQ <val> '..SLOT-UNBOUND..).
48 ;;; That is considerably faster than looking at the value of a special
51 ;;; It seems only reasonable to also export this for users, since
52 ;;; otherwise dealing with STANDARD-INSTANCE-ACCESS becomes harder
53 ;;; -- and slower -- than it needs to be.
54 (defconstant +slot-unbound
+ '..slot-unbound..
56 "SBCL specific extensions to MOP: if this value is read from an
57 instance using STANDARD-INSTANCE-ACCESS, the slot is unbound.
58 Similarly, an :INSTANCE allocated slot can be made unbound by
59 assigning this to it using (SETF STANDARD-INSTANCE-ACCESS).
61 Value of +SLOT-UNBOUND+ is unspecified, and should not be relied to be
62 of any particular type, but it is guaranteed to be suitable for EQ