If you could make any changes to D, what would they look like?

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Mon Oct 25 22:49:00 UTC 2021


On Monday, 25 October 2021 at 21:49:15 UTC, Paul Backus wrote:
> Sure, there's nothing preventing `@system` code from causing 
> undefined behavior. The difference is that in C++, all of your 
> code is `@system`; in D, only some of it is.

Yes, that is true. I don't write a lot of multi-threaded code, 
but when I do I tend to keep that to a small set of 
files/data-structures. As such I am keeping a "@system" subset in 
my source. It isn't checked by a compiler, but I am not sure that 
makes a big difference as I tend to encapsulate the "@system" 
parts using abstractions.

So if there is any benefit to the current version of "shared" it 
has to come from interacting with libraries. But there is little 
protection there since libraries can put themselves into 
"@trusted" mode at their own will? So, then the remaining 
advantage would be to have the opportunity to grep for 
@system/@trusted in library code...

I am not convinced that this is enough to be a significant 
advantage as I am not inclined to use libraries that aren't 
well-behaved (if they are a source for bugs, I'll most likely 
replace them wholesale).



More information about the Digitalmars-d mailing list