Revisiting default values
daniel.smith at oracle.com
Tue Jul 14 21:11:36 UTC 2020
> On Jul 14, 2020, at 6:39 AM, Peter Levart <peter.levart at gmail.com> wrote:
> What about a variant of G or J where an inline class would designate a single field to be used for "isDefault" checks. Instead of comparing all fields for "zero" value, a single designated field would be used in checks. So a class is free to choose which of the existing fields is "never zero/null" in the set of valid class states or can even add a special-purpose (boolean) field to be used just for that. Often no such special field would need to be added.
This is probably more fine-grained than I want to get into right now—let's choose a direction before drilling down on how we can make it fast—but, yes, in previous discussions we have considered using a designated field as the 'isDefault' signal, rather than doing a full 'val == Foo.default'. I don't know whether that's likely to be a worthwhile optimization or not.
More information about the valhalla-spec-observers