diff options
author | Andy Wingo <wingo@pobox.com> | 2019-10-27 21:28:21 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2019-10-27 21:31:18 +0100 |
commit | f963bdf02d7dd316884ccc9d590b3a7327406422 (patch) | |
tree | 2586cfc78892048f0c740213bf4cb134ddfe1127 /doc/ref/api-data.texi | |
parent | 7a8e314d31ef8d40dd692bc27a93bc30c328e2b7 (diff) | |
download | guile-f963bdf02d7dd316884ccc9d590b3a7327406422.tar.gz |
Rename final? record type flag; add support for opaque?
* module/ice-9/boot-9.scm (record-type-extensible?): Rename from
record-type-final?, with the opposite sense.
(record-type-opaque?): New accessor.
(make-record-type): Change #:final? to #:extensible?, with the
opposite meaning. Add #:opaque? arg.
* test-suite/tests/records.test ("records"): Add opaque tests; update
extensible tests.
* doc/ref/api-data.texi (Records): Update.
* module/srfi/srfi-35.scm (&condition, make-condition-type): Update for
make-record-type API change.
Diffstat (limited to 'doc/ref/api-data.texi')
-rw-r--r-- | doc/ref/api-data.texi | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/doc/ref/api-data.texi b/doc/ref/api-data.texi index d7af7754a..3385571c2 100644 --- a/doc/ref/api-data.texi +++ b/doc/ref/api-data.texi @@ -8631,7 +8631,8 @@ promise that records are disjoint with other Scheme types. @end deffn @deffn {Scheme Procedure} make-record-type type-name field-names [print] @ - [#:final?=@code{#t}] [#:parent=@code{#f}] [#:uid=@code{#f}] + [#:parent=@code{#f}] [#:uid=@code{#f}] @ + [#:extensible?=@code{#f}] [#:opaque?] @ Create and return a new @dfn{record-type descriptor}. @var{type-name} is a string naming the type. Currently it's only used @@ -8654,11 +8655,11 @@ followed by fields declared in the @code{make-record-type} call. Record predicates and field accessors for instance of a parent type will also work on any instance of a subtype. -@cindex final record types -@cindex record types, final +@cindex extensible record types +@cindex record types, extensible Allowing record subtyping has a small amount of overhead. To avoid this -overhead, declare the record type as @dfn{final} by passing -@code{#:final? #t}. Record types in Guile are final by default. +overhead, prevent extensibility by passing @code{#:extensible? #f}. +By default, record types in Guile are not extensible. @cindex prefab record types @cindex record types, prefab @@ -8671,6 +8672,14 @@ symbol as the @code{#:uid} keyword parameter. If a record with the given @var{uid} was already defined, it will be returned instead. The type name, fields, parent (if any), and so on for the previously-defined type must be compatible. + +@cindex record types, opaque +R6RS defines a notion of ``opaque'' record types. Given an instance of +an opaque record type, one cannot obtain a run-time representation of +the record type. @xref{rnrs records procedural}, for full details. The +@code{#:opaque?} flag is used by Guile's R6RS layer to record this +information. The default is determined by whether the parent type, if +any, was opaque. @end deffn @deffn {Scheme Procedure} record-constructor rtd |