On this page:
custom-write-function/  c
custom-write-mode/  c

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.


(make-named-object-custom-write type-name 
  [#:name-getter get-name]) 
  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.

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


> (person 'jared)


> (person #false)