In the context of Java's Project Valhalla, how can I generically initialize a value type with its default value?
Initially, I thought that assigning null to any value type would perform this initialization. However, the answers and comments to this question clearly show that null is a reference, so it has nothing to do with value types (precisely due to the fact that value types are not references, but direct values instead).
E.g. if I have a Person value type with StringValueType name and DateValueType dateOfBirth attributes (here dateOfBirth would be a nested value type containing int year, int month and int day attributes), how could I initialize my Person value type in a generic way so that the values of its attributes are "" for name and (0, 0, 0) (or the corresponding default value) for dateOfBirth, respectively?
To make it more clear, if this were C, I would do:
memset(myPersonStructVariable, 0, sizeof(Person));
Or in modern C:
struct Person myPersonStructVariable = {0};