Adding the ?. operator to D
doob at me.com
Fri Sep 18 14:10:50 UTC 2020
On 2020-09-16 23:26, Per Nordlöw wrote:
> You're saying you want the variant with `nullable` and make `nullable`
Not necessarily. It could be an overloadable operator that could be used
on any struct/class.
Ideally I would like pointers and reference types to be non-nullable by
default. Then have built-in support for optional types. Kind of like Swift.
int* a = null; // error, pointers cannot be null
int*? a = null; // fine, optional pointer to int
int? a = null; // fine, optional int
More information about the Digitalmars-d