[OT] my experience with nullable types (C#)
Kagamin
spam at here.lot
Sat May 3 14:15:32 UTC 2025
On Wednesday, 30 April 2025 at 09:06:20 UTC, Python wrote:
> You don't need `a! == b`, you can use directly `a == b`, there
> is no null check required here for the comparison to mandate
> the use of notnull operator (!)
Indeed can't find it now. I wonder where I saw it, maybe it was
in intermediate code. Or maybe I was confused since the type
system remains not very helpful: without nonnullability you're
unsure if a pointer is null, with nonnullability you're unsure if
a nullable pointer is not null, its type is still nullable, only
the compiler knows its nullability.
I could refine the type into nonnullable to make it statically
typed:
```
A? obj1=get();
A obj2=obj1!;
// obj1 is still nullable A?
```
More information about the Digitalmars-d
mailing list