Fix foreign slot initialization and access
authorAndy Wingo <wingo@pobox.com>
Sun, 27 Apr 2014 09:02:35 +0000 (11:02 +0200)
committerAndy Wingo <wingo@pobox.com>
Sun, 27 Apr 2014 09:02:35 +0000 (11:02 +0200)
commit48ad85fb56bc022ac10f42cf07b5657d75b5b696
tree3523ccd6bfb489e6fcdc44d27b8d6d78dcee06d8
parentfa1a30726dc28c58cb01594ae6df27e80d4c2f00
Fix foreign slot initialization and access

* libguile/goops.c (scm_sys_initialize_object): Refactor initialization
  so that we don't ref uninitialized slots before initializing them.
  This allows foreign slots, whose initial value is 0, to be initialized
  via #:init-form.

* module/oop/goops.scm (@slot-ref, @slot-set!): Remove definitions.
  Change callers to use struct-ref and struct-set!.  slot-ref and
  slot-set! were only marginally more efficient and were much more
  dangerous.  This change allows the standard accessors to work on
  foreign slots; that was not the case before, as the 'u' fields of the
  struct were read as if they were 'p' slots.
* module/language/tree-il/compile-glil.scm (lambda): Remove support for
  compiling @slot-ref/@slot-set!.  These were private to GOOPS.

* test-suite/tests/goops.test ("active-slot"): Update to not expect a
  ref before initialization.
  ("foreign slots"): Add tests.
libguile/goops.c
module/language/tree-il/compile-glil.scm
module/oop/goops.scm
test-suite/tests/goops.test