diff options
author | Andy Wingo <wingo@pobox.com> | 2017-09-22 10:25:38 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2017-09-22 10:32:33 +0200 |
commit | fe4a34d20d8342106a46fc2b842a892c17a11920 (patch) | |
tree | b0de9d3b4d1e4231749e8211ca8c80140234e042 /NEWS | |
parent | 53d4df80c91d0c744e86df421572f60bb9a80261 (diff) |
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.
Diffstat (limited to 'NEWS')
-rw-r--r-- | NEWS | 31 |
1 files changed, 31 insertions, 0 deletions
@@ -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". |