diff options
author | Andy Wingo <wingo@pobox.com> | 2015-01-18 20:53:19 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2015-01-23 16:16:03 +0100 |
commit | 568174d173e994eaac470123bb769a8847be11c7 (patch) | |
tree | 05b2c59c879979524f27eacb760126fa7d361a7f /module/oop/goops | |
parent | 26a6aaefac07e4f67252a47a5f3e23a305706241 (diff) | |
download | guile-568174d173e994eaac470123bb769a8847be11c7.tar.gz |
Introduce <slot> objects in GOOPS
* module/oop/goops.scm (fold-class-slots): Change format to use proper
slot specifications.
(fold-slot-slots): Flesh out with all needed slots.
(<class>): Update cons-layout to deal with new fold-class-slots form.
Don't create slots; we do that later.
(is-a?, get-keyword, *unbound, unbound?, %allocate-instance): Move
definitions up.
(<slot>, slot?): New definitions.
(slot-definition-name, slot-definition-allocation)
(slot-definition-init-keyword, slot-definition-init-form)
(slot-definition-init-value, slot-definition-init-thunk)
(slot-definition-options, slot-definition-getter)
(slot-definition-setter, slot-definition-accessor)
(slot-definition-slot-ref, slot-definition-slot-set!)
(slot-definition-index, slot-definition-size): New definitions as
accessors on <slot> objects.
(class-slot-definition): Adapt to class-slots change.
(direct-slot-definition-class, make-slot): New definitions.
(make): Define a boot version that can allocate <slot> instances.
(compute-direct-slot-definition)
(compute-direct-slot-definition-initargs)
(effective-slot-definition-class, compute-effective-slot-definition):
New definitions.
(build-slots-list): Adapt to slots being <slot> objects.
(compute-get-n-set): New boot definition.
(allocate-slots): New definition. Replaces
compute-getters-n-setters.
(%compute-layout, %prep-layout): Adapt to changes.
(make-standard-class): Make <slot> objects for direct-slots, and
handle the allocate-slots protocol.
(<foreign-slot>): Inherit from <slot>.
(get-slot-value-using-name, set-slot-value-using-name!)
(test-slot-existence): Adapt to using slot definition objects.
(make-class): Allow slot specs or <slot> objects as the `slots'
argument.
(write): New method on <slot>.
(class-slot-ref, class-slot-set!): Reimplement.
(compute-slot-accessors, compute-getter-method)
(compute-setter-method): Adapt to changes.
(compute-getters-n-setters): Remove. Yay!
(compute-get-n-set): Adapt to use effective slot definitions instead
of the getters-n-setters for #:class / #:each-subclass allocation.
(%initialize-object): Adapt.
(initialize): New method for <slot>. Adapt method for <class>.
* module/oop/goops/active-slot.scm (compute-get-n-set):
* module/oop/goops/composite-slot.scm (compute-propagated-get-n-set):
Use slot-definition-options to access options of slot.
* test-suite/tests/goops.test ("bad init-thunk"): Fix to be a "pass-if"
instead of an "expect-fail".
Diffstat (limited to 'module/oop/goops')
-rw-r--r-- | module/oop/goops/active-slot.scm | 2 | ||||
-rw-r--r-- | module/oop/goops/composite-slot.scm | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/module/oop/goops/active-slot.scm b/module/oop/goops/active-slot.scm index e9f606947..98f2d3f68 100644 --- a/module/oop/goops/active-slot.scm +++ b/module/oop/goops/active-slot.scm @@ -33,7 +33,7 @@ (define-method (compute-get-n-set (class <active-class>) slot) (if (eq? (slot-definition-allocation slot) #:active) (let* ((index (slot-ref class 'nfields)) - (s (cdr slot)) + (s (slot-definition-options slot)) (before-ref (get-keyword #:before-slot-ref s #f)) (after-ref (get-keyword #:after-slot-ref s #f)) (before-set! (get-keyword #:before-slot-set! s #f)) diff --git a/module/oop/goops/composite-slot.scm b/module/oop/goops/composite-slot.scm index bd3eb941e..2bd6a1867 100644 --- a/module/oop/goops/composite-slot.scm +++ b/module/oop/goops/composite-slot.scm @@ -1,6 +1,6 @@ ;;; installed-scm-file -;;;; Copyright (C) 1999, 2000, 2001, 2006 Free Software Foundation, Inc. +;;;; Copyright (C) 1999, 2000, 2001, 2006, 2015 Free Software Foundation, Inc. ;;;; Copyright (C) 1993-1998 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr> ;;;; ;;;; This library is free software; you can redistribute it and/or @@ -53,7 +53,9 @@ (next-method))) (define (compute-propagated-get-n-set s) - (let ((prop (get-keyword #:propagate-to (cdr s) #f)) + (let ((prop (get-keyword #:propagate-to + (slot-definition-options s) + #f)) (s-name (slot-definition-name s))) (if (not prop) |