On Tuesday, 24 May 2022 at 13:43:07 UTC, Adam D Ruppe wrote:
> 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.
Says the guy who proclaimed "I don't care about @safe". Please understand that we are just not on the same page until you have a sufficient understanding about the @safe attribute, the reasons why it exists and its interaction with the '-release' command line option. That's why I asked you to check it up.
> You might notice I said "default safety features". Here's the facts.
D's default: significant safety by default,
Do you mean that @system code with bounds checking enabled provides "significant safety"? I don't think that this is enough, but this is just my opinion and you are always free to disagree. I think that the other programming languages are setting the bar much higher than that.
> 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.
There are multiple problem with this approach. The most severe of them is that the ".ptr" construct does not provide bounds checking in debug builds. Convenience is a major factor too, and despite your claims I don't agree that ".ptr" is convenient. I personally don't see any reasons to use it.
> 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
Did you even read my replies? You got everything backwards. I'm in favor of having everything @safe by default and then opt out on a case-by-case basis by adding @trusted where necessary. This works very nicely with the current '-release' option. Whoever implemented it this way did a great job!
I remind you that there's no obligation for us to agree. And no, having a different opinion is not a personal attack.
> The compiler is likely to fight you throughout this process as
other library authors must also remember to opt into it.
Yes, not all libraries are fully compatible with @safe and this is probably something that could be improved. Thankfully my use cases don't depend on the other libraries at the moment.
> A programming language ought to align with safety and common use. -release does the opposite of this, with very little warning.
See above. We just have a major disagreement here.
> 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.
Your standards of what is "convenient" are obviously very different from mine.