On this page:
struct-descriptor?
initialized-struct-descriptor?
uninitialized-struct-descriptor?
struct-descriptor-type
struct-descriptor-super-type
struct-descriptor-name
struct-descriptor-mutable-fields
struct-descriptor-immutable-fields
struct-descriptor-auto-fields
struct-descriptor-constructor
struct-descriptor-predicate
struct-descriptor-accessor
struct-descriptor-mutator
make-struct-implementation
7.7

2.8 Struct Descriptors

 (require rebellion/type/struct) package: rebellion

procedure

(struct-descriptor? v)  boolean?

  v : any/c
A predicate for structure type descriptors, initialized or uninitialized.

procedure

(initialized-struct-descriptor? v)  boolean?

  v : any/c
A predicate for initialized structure type descriptors, as returned by the make-struct-implementation function. Implies struct-descriptor?.

procedure

(uninitialized-struct-descriptor? v)  boolean?

  v : any/c
A predicate for uninitialized structure type descriptors, as passed to the prop-maker argument of make-struct-implementation. An uninitialized descriptor’s constructor, predicate, accessor, and mutator functions must not be called until the structure type is created — that is, until the corresponding call to make-struct-implementation returns.

procedure

(struct-descriptor-type descriptor)  struct-type?

  descriptor : initialized-struct-descriptor?
Returns the raw struct-type? instance in descriptor, which must be initialized. Uninitialized structure type descriptors do not yet have an associated struct-type? instance.

procedure

(struct-descriptor-super-type descriptor)

  (or/c struct-info? #f)
  descriptor : struct-descriptor?

procedure

(struct-descriptor-name descriptor)  symbol?

  descriptor : struct-descriptor?

procedure

(struct-descriptor-mutable-fields descriptor)  natural?

  descriptor : struct-descriptor?

procedure

(struct-descriptor-immutable-fields descriptor)  natural?

  descriptor : struct-descriptor?

procedure

(struct-descriptor-auto-fields descriptor)  natural?

  descriptor : struct-descriptor?

procedure

(struct-descriptor-constructor descriptor)  procedure?

  descriptor : struct-descriptor?

procedure

(struct-descriptor-predicate descriptor)  (-> any/c boolean?)

  descriptor : struct-descriptor?

procedure

(struct-descriptor-accessor descriptor)

  (-> any/c natural? any/c)
  descriptor : struct-descriptor?

procedure

(struct-descriptor-mutator descriptor)

  (-> any/c natural? any/c void?)
  descriptor : struct-descriptor?
Accessors for the various fields of a structure type descriptor.

procedure

(make-struct-implementation 
  #:name name 
  [#:mutable-fields mutable-fields 
  #:immutable-fields immutable-fields 
  #:auto-fields auto-fields 
  #:auto-field-value auto-value 
  #:super-type super-type 
  #:property-maker prop-maker 
  #:inspector inspector 
  #:guard guard 
  #:constructor-name constructor-name]) 
  initialized-struct-descriptor?
  name : symbol?
  mutable-fields : natural? = 0
  immutable-fields : natural? = 0
  auto-fields : natural? = 0
  auto-value : any/c = #f
  super-type : (or/c struct-type? #f) = #f
  prop-maker : 
(-> uninitialized-struct-descriptor?
    (listof (cons/c struct-type-property? any/c)))
   = (λ (_) empty)
  inspector : (or/c inspector? 'prefab #f) = (current-inspector)
  guard : (or/c procedure? #f) = #f
  constructor-name : (or/c symbol? #f) = #f
Like make-struct-type, but with keyword arguments instead of positional arguments and returning a single struct-descriptor? value instead of multiple values. Additional differences include:

Examples:
> (define point-descriptor
    (make-struct-implementation #:name 'point #:immutable-fields 2))
> (define point (struct-descriptor-constructor point-descriptor))
> (point 1 2)

#<point>