Shouldn't safety be the default.

Paul Backus snarwin at gmail.com
Tue Dec 26 17:32:55 UTC 2023


On Tuesday, 26 December 2023 at 07:05:48 UTC, Hors wrote:
> Optional safety is really outdated, I think some people can't 
> see how important is safety almost everywhere (both for system 
> and general purpose). Safe by default allows you to catch bugs 
> without possibly wrecking your entire system (or systems' of 
> users of your app).

The correct way forward on this is to enable inference of `@safe` 
for (almost) all functions. No existing projects will break, and 
if you don't use any unsafe language features (pointer 
arithmetic, casting), your code will automatically become `@safe` 
with no intervention required.

Adam Ruppe has a good writeup of this approach on his blog: 
http://dpldocs.info/this-week-in-d/Blog.Posted_2022_07_11.html#inferred-attributes


More information about the Digitalmars-d mailing list