Memory safe in D

cc cc at nevernet.com
Thu Mar 14 00:32:47 UTC 2024


On Wednesday, 13 March 2024 at 07:43:23 UTC, Alex wrote:
> I mean nullable types like in Kotlin (originally in Ceylon) and 
> null safety model around it: 
> https://kotlinlang.org/docs/null-safety.html
> ```d
> if (a != null) {
>     a.run(); // ok, because type of variable 'a' is A (not 
> nullable) in this branch.
> }
> ```

I like this, can the compiler handle cases like this?
```d
if (a == null)
	return;
a.run();
```


More information about the Digitalmars-d mailing list