8.16.0.1
This package provides a mechanism for associating
arbitrary metadata with values.
It’s inspired by Clojure’s
metadata.
Attaching metadata to a value does not affect
equal? or chaperone-of? comparisons,
but it may affect eq? comparisons.
The following datatypes support metadata:
procedures, transparent structs, vectors,
boxes, hashes, sets, struct types, events,
channels, continuation prompt tags,
continuation mark keys, pairs, regular expressions,
byte regular expressions, opaque structs (so long
as the struct type descriptor is provided).
Under the hood,
it uses
Impersonator Properties
to store metadata for datatypes that support
chaperones.
For others (pairs and regular expressions),
it copies the value
and uses a weak mutable hash table
(compared with eq?)
to store metadata
behind the scenes.
Returns whether v can have metadata (without providing
a struct type descriptor).
Returns the value for
key in the metadata for
v.
If no value is found for
key, then
failure-result
determines the result in the same way as
hash-ref.
Returns #t if the metadata for v
contains a value for the given key,
#f otherwise.
Returns a value that is
equal? to
v,
but where the metadata maps
key to
val,
overwriting any existing mapping for
key.
Returns a value that is
equal? to
v,
but with the metadata updated in the same way as
hash-update.
Removes any existing mapping for key in the metadata
for v.