;;;; tinyclos.scm - A port of Kiczales TinyCLOS to Chicken - felix ; ; ; ********************************************************************** ; Copyright (c) 1992 Xerox Corporation. ; All Rights Reserved. ; ; Use, reproduction, and preparation of derivative works are permitted. ; Any copy of this software or of any derivative work must include the ; above copyright notice of Xerox Corporation, this paragraph and the ; one after it. Any distribution of this software or derivative works ; must comply with all applicable United States export control laws. ; ; This software is made available AS IS, and XEROX CORPORATION DISCLAIMS ; ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE ; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR ; PURPOSE, AND NOTWITHSTANDING ANY OTHER PROVISION CONTAINED HEREIN, ANY ; LIABILITY FOR DAMAGES RESULTING FROM THE SOFTWARE OR ITS USE IS ; EXPRESSLY DISCLAIMED, WHETHER ARISING IN CONTRACT, TORT (INCLUDING ; NEGLIGENCE) OR STRICT LIABILITY, EVEN IF XEROX CORPORATION IS ADVISED ; OF THE POSSIBILITY OF SUCH DAMAGES. ; ********************************************************************** ; ; ; [felix] I have stolen several optimizations from Eli Barzilay's Swindle code - thanks anyway! ;; Issues ;; ;; - Uses implementation details of unit lolevel procedures so unit lolevel ;; not used. ;; ;; - The class-of set extension implementation isn't thread-safe. In practice ;; probably not an issue. The class-of builtins set will be extended, most ;; likely, by "module initialization" code (invoked upon load). Since it ;; is rare for a thread to load an extension explicitly no conflicts should ;; occur. (declare (not usual-integrations integer?) (fixnum) (disable-interrupts)) (cond-expand [paranoia] [else (declare (no-bound-checks) (no-procedure-checks-for-usual-bindings) (bound-to-procedure #| ; Exposition only ##sys#cons ##sys#size ##sys#slot ##sys#setslot ##sys#generic-structure? ##sys#structure? ##sys#bytevector? ##sys#null-pointer? ##sys#immediate? ##sys#check-list |# ##sys#symbol->string ##sys#error ##sys#signal-hook ##sys#lambda-decoration) ) ] ) (module tinyclos (slot@ define-class define-generic define-method define-class* make-class make-generic make-method add-method make initialize slot-ref slot-set! class-name class-of class-direct-supers class-direct-slots class-cpl class-slots method-specializers method-procedure allocate-instance compute-cpl compute-slots compute-getter-and-setter compute-apply-generic compute-methods compute-method-more-specific? compute-apply-methods print-object describe-object instance-of? subclass? instance? make/copy initialize-slots add-global-method ;*** ? make-instance-from-pointer new-primitive-class delete-primitive-class new-extended-procedure-class delete-extended-procedure-class delete-structure-class new-structure-class delete-tagged-pointer-class new-tagged-pointer-class define-primitive-class define-structure-class define-extended-procedure-class define-tagged-pointer-class