expose struct:struct-info
svn: r8753
This commit is contained in:
parent
3740b05660
commit
b953b448ba
|
@ -7,9 +7,10 @@
|
||||||
|
|
||||||
(#%provide make-struct-info
|
(#%provide make-struct-info
|
||||||
struct-info?
|
struct-info?
|
||||||
extract-struct-info)
|
extract-struct-info
|
||||||
|
struct:struct-info)
|
||||||
|
|
||||||
(define-values (struct:struct-info create-struct-info struct-info-rec?
|
(define-values (struct:struct-info make-struct-info struct-info-rec?
|
||||||
struct-info-ref struct-info-set!)
|
struct-info-ref struct-info-set!)
|
||||||
(make-struct-type 'struct-info #f
|
(make-struct-type 'struct-info #f
|
||||||
1 0 #f
|
1 0 #f
|
||||||
|
@ -18,16 +19,15 @@
|
||||||
(raise-syntax-error
|
(raise-syntax-error
|
||||||
#f
|
#f
|
||||||
"identifier for static struct-type information cannot be used as an expression"
|
"identifier for static struct-type information cannot be used as an expression"
|
||||||
stx))))
|
stx))
|
||||||
|
null
|
||||||
(define-values (make-struct-info)
|
(lambda (proc info)
|
||||||
(lambda (proc)
|
(if (and (procedure? proc)
|
||||||
(if (and (procedure? proc)
|
(procedure-arity-includes? proc 0))
|
||||||
(procedure-arity-includes? proc 0))
|
proc
|
||||||
(create-struct-info proc)
|
(raise-type-error 'make-struct-info
|
||||||
(raise-type-error 'make-struct-info
|
"procedure (arity 0)"
|
||||||
"procedure (arity 0)"
|
proc)))))
|
||||||
proc))))
|
|
||||||
|
|
||||||
(define-values (extract-struct-info)
|
(define-values (extract-struct-info)
|
||||||
(lambda (si)
|
(lambda (si)
|
||||||
|
|
|
@ -361,8 +361,8 @@ information can be used during the expansion of other expressions via
|
||||||
@scheme[syntax-local-value].
|
@scheme[syntax-local-value].
|
||||||
|
|
||||||
For example, the @scheme[define-struct] variant for subtypes uses the
|
For example, the @scheme[define-struct] variant for subtypes uses the
|
||||||
base type name @scheme[t] to find the variable
|
base type name @scheme[_t] to find the variable
|
||||||
@scheme[struct@scheme[:t]] containing the base type's descriptor; it
|
@schemeidfont{struct:}@scheme[_t] containing the base type's descriptor; it
|
||||||
also folds the field accessor and mutator information for the base
|
also folds the field accessor and mutator information for the base
|
||||||
type into the information for the subtype. As another example, the
|
type into the information for the subtype. As another example, the
|
||||||
@scheme[match] form uses a type name to find the predicates and field
|
@scheme[match] form uses a type name to find the predicates and field
|
||||||
|
@ -449,3 +449,11 @@ form.}
|
||||||
|
|
||||||
Extracts the list form of the structure type information represented
|
Extracts the list form of the structure type information represented
|
||||||
by @scheme[v].}
|
by @scheme[v].}
|
||||||
|
|
||||||
|
@defthing[struct:struct-info struct-type?]{
|
||||||
|
|
||||||
|
The @tech{structure type descriptor} for the structure type returned
|
||||||
|
by @scheme[make-struct-info]. This @tech{structure type descriptor} is
|
||||||
|
mostly useful for creating structure subtypes. The structure type
|
||||||
|
includes a guard that checks an instance's first field in the same way
|
||||||
|
as @scheme[make-struct-info].}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user