mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-24 12:20:20 +02:00
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>.
This commit is contained in:
parent
9e2cd55ec8
commit
6c7dd9ebd3
5 changed files with 117 additions and 138 deletions
|
@ -117,10 +117,6 @@ SCM_PRIMITIVE_GENERIC (scm_setter, "setter", 1, 0, 0,
|
|||
return scm_wta_dispatch_1 (g_scm_setter, proc, SCM_ARG1, FUNC_NAME);
|
||||
if (SCM_STRUCT_SETTER_P (proc))
|
||||
return SCM_STRUCT_SETTER (proc);
|
||||
if (SCM_PUREGENERICP (proc)
|
||||
&& SCM_IS_A_P (proc, scm_class_generic_with_setter))
|
||||
/* FIXME: might not be an accessor */
|
||||
return SCM_GENERIC_SETTER (proc);
|
||||
return scm_wta_dispatch_1 (g_scm_setter, proc, SCM_ARG1, FUNC_NAME);
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue