diff options
author | Andy Wingo <wingo@pobox.com> | 2017-09-23 11:14:27 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2017-09-23 11:14:27 +0200 |
commit | b0ecf83ef0f3dfbfce808c2cfc88ff0c8d9809f1 (patch) | |
tree | ce37041419fae8b1c3815b2a2756b74986060d60 /libguile/struct.c | |
parent | 84aa050f927d704344a7efca6b63607254e0b5b2 (diff) | |
download | guile-b0ecf83ef0f3dfbfce808c2cfc88ff0c8d9809f1.tar.gz |
Deprecate opaque struct fields
* NEWS: Add entry.
* doc/ref/api-data.texi (Vtables, Structure Basics): Remove mention of
opaque field protection.
* libguile/struct.c (scm_make_struct_layout, scm_make_struct_no_tail):
Remove discussion of opaque fields.
(set_vtable_layout_flags): Issue a deprecation warning when opaque
fields are used.
Diffstat (limited to 'libguile/struct.c')
-rw-r--r-- | libguile/struct.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/libguile/struct.c b/libguile/struct.c index 5c03f4fb0..1363fea90 100644 --- a/libguile/struct.c +++ b/libguile/struct.c @@ -71,8 +71,8 @@ SCM_DEFINE (scm_make_struct_layout, "make-struct-layout", 1, 0, 0, "type, the second a field protection. Allowed types are 'p' for\n" "GC-protected Scheme data, 'u' for unprotected binary data. \n" "Allowed protections\n" - "are 'w' for mutable fields, 'h' for hidden fields, 'r' for read-only\n" - "fields, and 'o' for opaque fields.\n\n" + "are 'w' for mutable fields, 'h' for hidden fields, and\n" + "'r' for read-only fields.\n\n" "Hidden fields are writable, but they will not consume an initializer arg\n" "passed to @code{make-struct}. They are useful to add slots to a struct\n" "in a way that preserves backward-compatibility with existing calls to\n" @@ -174,6 +174,13 @@ set_vtable_layout_flags (SCM vtable) flags &= ~SCM_VTABLE_FLAG_SIMPLE_RW; break; + case 'o': + case 'O': + scm_c_issue_deprecation_warning + ("Opaque struct fields are deprecated. Struct field protection " + "should be layered on at a higher level."); + /* Fall through. */ + default: flags = 0; } @@ -564,8 +571,8 @@ SCM_DEFINE (scm_make_struct_no_tail, "make-struct/no-tail", 1, 0, 1, "The @var{init1}, @dots{} are optional arguments describing how\n" "successive fields of the structure should be initialized.\n" "Only fields with protection 'r' or 'w' can be initialized.\n" - "Fields with protection 'o' can not be initialized by Scheme\n" - "programs.\n\n" + "Hidden fields (those with protection 'h') have to be manually\n" + "set.\n\n" "If fewer optional arguments than initializable fields are supplied,\n" "fields of type 'p' get default value #f while fields of type 'u' are\n" "initialized to 0.") |