Better branding of -betterC

Paul Backus snarwin at gmail.com
Thu Nov 12 23:43:27 UTC 2020


On Thursday, 12 November 2020 at 21:22:37 UTC, Dibyendu Majumdar 
wrote:
>
> Sorry I didn't make myself clear.
> In Rust for example unions are unsafe whereas enumerated types 
> aren't (caveat: this is based on my imperfect knowledge). So 
> having it in the language allows the compiler to better infer 
> safety of the code, and thus help the programmer make better 
> choices.

In D, unions are @system and SumTypes are @safe, which as far as 
I can tell amounts to basically the same thing. Is there 
something I'm missing here?

Obviously D's safety analysis is not quite as sophisticated as 
Rust's, but that would still be true even if D had built-in 
discriminated unions.


More information about the Digitalmars-d mailing list