On this page:
custom-write-function/  c
custom-write-mode/  c
make-named-object-custom-write
8.12

8.1 Custom Write Implementations🔗ℹ

 (require rebellion/custom-write) package: rebellion

A custom write implementation is a function that prints values and is suitable for use with prop:custom-write. Custom write implementations must satisfy the custom-write-function/c contract.

A contract describing functions suitable for use with prop:custom-write.

A contract describing the mode argument to functions matching custom-write-function/c. See gen:custom-write for details.

procedure

(make-named-object-custom-write type-name 
  [#:name-getter get-name]) 
  custom-write-function/c
  type-name : symbol?
  get-name : (-> any/c (or/c symbol? #false)) = object-name
Constructs a custom write implementation that prints values as opaque, unreadable, named objects, similar to the way functions are printed.

Examples:
> (struct person (name)
    #:property prop:object-name (struct-field-index name)
    #:property prop:custom-write (make-named-object-custom-write 'person))
> (person 'alyssa)

#<person:alyssa>

> (person 'jared)

#<person:jared>

> (person #false)

#<person>