rebellion icon indicating copy to clipboard operation
rebellion copied to clipboard

Accessor names for fields can cause difficult-to-resolve conflicts

Open jackfirth opened this issue 5 years ago • 0 comments

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.

jackfirth avatar Apr 17 '19 01:04 jackfirth