13 ms·
I'm not familiar with Java. Does it have no notion of structural types at all? If it does, maybe you could wrap those fields in `Car` with `Maybe`/`Option` (I’m
by nicoty 2y ago
I'm not familiar with Java. Does it have no notion of structural types at all? If it does, maybe you could wrap those fields in `Car` with `Maybe`/`Option` (I’m not sure what the equivalent is in Java) so you get something like `Car(Maybe Make, Maybe Model, Maybe Year, Maybe Colour)`?
- spullara 2y agoyes and it is called Optional (rather than Maybe)
- vips7L 2y agoRecords are structural types. Null restricted types are in draft: https://openjdk.org/jeps/8303099 https://openjdk.org/jeps/8303099
- htuyfjsdkfw 2y agoRecords in Java are nominal. In fact, it is syntax sugar for a class.