Generics with setters have <applicable-struct-with-setter> layout
authorAndy Wingo <wingo@pobox.com>
Tue, 6 Jan 2015 18:41:56 +0000 (13:41 -0500)
committerAndy Wingo <wingo@pobox.com>
Fri, 23 Jan 2015 15:16:00 +0000 (16:16 +0100)
commit6c7dd9ebd3702c71adf5dcce9509294ebb52f226
treeaa84e17a3a3de1aa01efcd67225c178417810aab
parent9e2cd55ec818fad72e99a0295fbbff3cfca7ff0c
Generics with setters have <applicable-struct-with-setter> layout

* libguile/goops.c (scm_sys_set_object_setter_x): Remove.  Instead, we
  use slot-set! of 'setter.
  (scm_i_define_class_for_vtable): Move lower in the file, and fold in
  scm_make_extended_class_from_symbol and make_class_from_symbol.
  Properly handle applicable structs with setters.
  (scm_class_applicable_struct_with_setter_class): New private capture.
  (scm_sys_bless_applicable_struct_vtables_x): Rename to take two
  arguments, and bless the second argument as an applicable struct with
  setter vtable.
  (scm_sys_goops_early_init): Capture setter classes.

* libguile/deprecated.c (SPEC_OF, CPL_OF): Access slots by name, not by
  index.
  (applicablep, more_specificp): Adapt to use CPL_OF.
  (scm_find_method): Access "methods" slot by name.

* libguile/procs.c (scm_setter): Remove special case for generics; if
  it's a setter, it will be a normal applicable struct.
* module/oop/goops.scm (<applicable-struct-with-setter-class>)
  (<applicable-struct-with-setter>): New classes.
  (<generic-with-setter>): Now an instance of the setter metaclass and a
  child of the setter class, so that the "setter" slot ends up in the
  right place.
  (<accessor>, <extended-generic-with-setter>, <extended-accessor>): Be
  instances of the setter metaclass.
  (<method>, <accessor-method>): Move definitions farther down.
  (make): Use slot-set! when initializing setters here.
  (initialize): Likewise for <applicable-struct-with-setter>.  Remove
  specialization for <generic-with-setter>.
libguile/deprecated.c
libguile/goops.c
libguile/goops.h
libguile/procs.c
module/oop/goops.scm