3 ms·
If you have to check it for null then, by definition, some_field here isn't a nullable type. If it was, you'd just do: object.some_field.foo(); Am I missi
by munificent 16y ago
If you have to check it for null then, by definition, some_field here isn't a nullable type. If it was, you'd just do:
object.some_field.foo();
Am I missing something here?
- masklinn 16y agoC# (values) or Nice don't use a full, explicit nullable generic type, and instead tag the original type (`int?` for C#, `?String` for Nice). This means some_field could be a type tagged as nullable (e.g. `some_field` would be defined as ?Foo). An alternative would be `@NotNull` opt-in anotations, where `some_field` would not be tagged, therefore nullable, therefore could hold the value `null`. Thus, if you have to check it for null then `some_field` is a nullable reference, in a language which may have nullable and non-nullable references.