[OT] my experience with nullable types (C#)

user1234 user1234 at 12.de
Wed May 7 07:32:17 UTC 2025


On Wednesday, 7 May 2025 at 07:08:43 UTC, Python wrote:
> BTW, NET10 will have a new operator, the null check assignment:
>
>
> `someRef?.Prop = 10` will be shorthand for:
>
> ```
> if (someRef != null)
>   someRef.Prop = 10;
> ```

Curious, I'd rather would have implemented that using an hidden 
alloca:

```
PropType __tmp;
(someRef ? someRef.Prop : __tmp) = 10;
```

Actually having `?.` implemented to yield a hidden value when the 
LHS evaluates to false would have made the assignment case 
already working since years.



More information about the Digitalmars-d mailing list