Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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)`?


Records are structural types. Null restricted types are in draft: https://openjdk.org/jeps/8303099


Records in Java are nominal. In fact, it is syntax sugar for a class.


yes and it is called Optional (rather than Maybe)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: