17203, "bradcray", "How close is Chapel to having a mix-in like feature for records?", "2021-02-19T19:57:40Z"
In 2016, we were debating the value or liability of having record inheritance in Chapel and ended up deciding that we should not support it, but should look into some sort of "mix-in" (or "mixin") capability instead as a means of sharing common capabilities across records and reducing code duplication. While thinking about this idea last night for the first time in awhile, I found myself wondering whether we might actually be quite close to having a similar capability through a combination of forwarding and/or interfaces.
Specifically, via forwarding, it seems I could create a field of another record type, set up forwarding to that field, and essentially inherit all of its capabilities. With interfaces, while I wouldn't have the ability to define fields within the interface, since I can define default implementations of routines, that could potentially serve as a way of "inheriting" methods (that would need to act upon fields that I declared myself presumably.
Not being an expert in mix-ins in other language, this issue asks whether there's more we would want here from a mix-in like capability, or whether features we have (or are currently working on, like interfaces) fit the bill?