-preview=safer for D
Paul Backus
snarwin at gmail.com
Sat Dec 14 20:30:35 UTC 2024
On Saturday, 14 December 2024 at 08:46:35 UTC, Walter Bright
wrote:
> Now that this has been merged into master, what are your
> reactions?
I agree with Jonathan M Davis that the behavior of this flag
should never be made the default.
As I said in my response to the initial proposal [1], it has all
of the costs of @safe-by-default (breaks lots of existing code)
without any of the benefits (reducing attribute spam and
ecosystem fragmentation). It does nothing to help D programmers
who are already using @safe, and creates a new source of
annoyance for people who are currently happy with @system as the
default.
The easiest way to satisfy the compiler when -preview=safer is
enabled is to mark all the functions it flags as explicitly
@system. Because of this, I think it's unlikely that
-preview=safer will achieve its stated goal of "mov[ing] such
code to @safe" [2].
[1]
https://forum.dlang.org/post/dkbrgvjcqsdpuvaeckty@forum.dlang.org
[2]
https://github.com/WalterBright/documents/blob/38f0a846726b571f8108f6e63e5e217b91421c86/safer.md#rationale
More information about the Digitalmars-d
mailing list