Suzanne Soy <racket@suzanne.soy>
syntax
options...)maybe-type-vars =| (v...)maybe-parent =| parent-idoptions = #:transparentcustom-write :(→name;non-polymorphic caseOutput-Port(U#t#f01)Any)equal+hash :(List(→name;non-polymorphic casename(→AnyAnyBoolean)Any)(→v(→AnyInteger)Integer)(→v(→AnyInteger)Integer))
For prop:custom-write and prop:equal+hash , the function types are polymorphic only if the struct is polymorphic (i.e. maybe-type-vars is present) and has at least one type variable (i.e. maybe-type-vars is not just ()).
It implements these struct type properties in a type-safe manner: the current implementation in typed/racket does not properly type-check functions and values used as struct type properties. This library declares the user-provided functions outside of the struct definition, with the type given above (e.g. (∀(v... )(→(namev... )Output-Port(U#t#f01)Any)) for the argument of the prop:custom-write property), to ensure that these functions and values are properly checked.
If typed/racket eventually implements the same interface as the one provided by this library, then we will update this library so that it simply re-provide struct renamed as struct/props .
If typed/racket eventually implements some type-safe struct type properties, then we will update this library will so that it translates back to typed/racket’s implementation, as much as possible.
If typed/racket eventually disallows struct type properties, then we will update this library so that it uses some typed/racket/unsafe tricks to still make them available, if it can be done.