Why is D unpopular?
Adam D Ruppe
destructionator at gmail.com
Tue May 24 13:43:07 UTC 2022
On Tuesday, 24 May 2022 at 12:51:32 UTC, Siarhei Siamashka wrote:
> Please educate yourself about the @safe attribute.
Please refrain from uninformed personal attacks.
You might notice I said "default safety features". Here's the
facts.
D's default: significant safety *by default*, eliminating over
90% of C-specific bugs (which btw are a minority of actual bugs;
it is important to remember to keep it in perspective). Where it
is necessary to bypass these important checks, which btw is a
small minority of places, you can use .ptr locally, after
verifying correctness, to disable it selectively while keeping
safety by default.
By contrast, once you choose to use -release, you get *security
holes* by default, which is the opposite of what you want when
actually releasing code to real users! You can then opt back into
minimum safety checks (which you want in a vast majority of
places) on a case-by-case basis by adding `@safe` (...until some
poor user is told to use -boundscheck=off but that's on them, at
least that switch sounds like you should think twice, unlike
-release which sounds harmless while being anything but). The
compiler is likely to fight you throughout this process as other
library authors must also remember to opt into it.
A programming language ought to align with safety and common use.
-release does the opposite of this, with very little warning.
Never using it, on the other hand, aligns with these virtues,
while still letting you very conveniently bypass checks when it
is genuinely necessary and beneficial.
More information about the Digitalmars-d
mailing list