rebellion
rebellion copied to clipboard
Accessor names for fields can cause difficult-to-resolve conflicts
In this code, the generated field accessor for the type
field of the widget
tuple is named widget-type
and conflicts with the widget-type
tuple:
(define-tuple-type widget (type size weight))
(define-tuple-type widget-type (name))
A common means of resolving this is to prefix the field with get-
in the accessor name, e.g. widget-get-type
. Rebellion's type-definition macros (define-tuple-type
, define-variant-type
, etc.) should support this natively since working around it requires abandoning the type definition macros and working with the type descriptors directly, which generates a lot of boilerplate for every single field even when only one field has a naming conflict.