DIP 1028---Make @safe the Default---Community Review Round 1
Dominikus Dittes Scherkl
dominikus at scherkl.de
Thu Jan 2 15:38:22 UTC 2020
On Thursday, 2 January 2020 at 15:29:38 UTC, jmh530 wrote:
> On Thursday, 2 January 2020 at 15:08:41 UTC, Dominikus Dittes
> Scherkl wrote:
>> [snip]
>>
>> No, this should not be necessary. baz() compiles with @safe as
>> default, so it should not be annotated @system automatically.
>> And if it doesn't compile, that would be a bug in the original
>> code, so it is a good thing that the test now fails.
>
> Under current behavior, baz is @system by default, but that
> will change to @safe with this DIP. If both baz and foo are
> annotated with either @safe or @system, then the program
> (excluding the UTs) compiles without errors. The problem is
> that the behavior of foo changes if baz is marked @safe rather
> than @system. You might argue that this is a bug, but it wasn't
> a bug originally. Your approach would have turned a bug-free
> program into a buggy one.
No, I argue the program was originally buggy: is got the false
information that baz is nor safe, but it is only due to a missing
annotation (e.g. if buz were a template, it would have been
assumed to be @safe)
I hope that very few code out there actually use such bad
mechanisms (e.g. call different functions depending on there
@safe annotation)-
More information about the Digitalmars-d
mailing list