From fe4a34d20d8342106a46fc2b842a892c17a11920 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Fri, 22 Sep 2017 10:25:38 +0200 Subject: Deprecate make-struct * libguile/struct.c: Replace uses of scm_make_struct with scm_make_struct_no_tail or scm_c_make_struct. (scm_make_struct_no_tail): Move this function to C instead of Scheme to be able to deprecate scm_make_struct. * libguile/struct.h (scm_make_struct_no_tail): New public declaration. * libguile/deprecated.h: * libguile/deprecated.c (scm_make_struct): Deprecate. * libguile/print.c: * libguile/procs.c: * libguile/stacks.c: Replace uses of scm_make_struct with scm_make_struct_no_tail. * test-suite/tests/coverage.test: * test-suite/tests/structs.test: Use make-struct/no-tail instead of make-struct. * NEWS: Add entry. --- NEWS | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'NEWS') diff --git a/NEWS b/NEWS index 7ce583b9b..f13f40a86 100644 --- a/NEWS +++ b/NEWS @@ -26,6 +26,37 @@ If you don't care whether the URI is a relative-ref or not, use In the future `uri?' will return a true value only for URIs that specify a scheme. +** Tail arrays deprecated + +Guile's structures used to have a facility whereby each instance of a +vtable can contain a variable-length tail array of values. The length +of the tail array was stored in the structure. This facility was +originally intended to allow C code to expose raw C structures with +word-sized tail arrays to Scheme. + +However, the tail array facility was confusing and doesn't work very +well. It was very rarely used, but it insinuates itself into all +invocations of `make-struct'. For this reason the clumsily-named +`make-struct/no-tail' procedure can actually be more elegant in actual +use, because it doesn't have a random `0' argument stuck in the middle. + +Tail arrays also inhibit optimization by allowing instances to affect +their shapes. In the absence of tail arrays, all instances of a given +vtable have the same number and kinds of fields. This uniformity can be +exploited by the runtime and the optimizer. The presence of tail arrays +make some of these optimizations more difficult. + +Finally, the tail array facility is ad-hoc and does not compose with the +rest of Guile. If a Guile user wants an array with user-specified +length, it's best to use a vector. It is more clear in the code, and +the standard optimization techniques will do a good job with it. + +For all of these reasons, tail arrays are deprecated in Guile 2.2 and +will be removed from Guile 3.0. Likewise, `make-struct' / +`scm_make_struct' is deprecated in favor of `make-struct/no-tail' / +`scm_make_struct_no_tail'. Perhaps one day we will be able to reclaim +the `make-struct' name! + * Bug fixes ** Enable GNU Readline 7.0's support for "bracketed paste". -- cgit v1.2.3