DIP 1028 "Make @safe the Default" is dead
Arine
arine1283798123 at gmail.com
Fri May 29 21:40:48 UTC 2020
On Friday, 29 May 2020 at 21:18:13 UTC, Walter Bright wrote:
> On 5/29/2020 2:07 AM, Timon Gehr wrote:
>> It would be great if `@safe:` did not affect declarations that
>> would otherwise infer annotations.
>
> The idea is the simple, general rule that:
>
> attribute declaration;
> attribute { declaration; }
> attribute: declaration;
>
> behave the same way.
>
> C++ is full of special cases which nobody remembers until they
> bite.
>
> Having a simple, general rule with maybe a less favorable
> effect here and there is preferable to a complex set of special
> cases that try to do the optimal thing in each case.
D already has a bunch of special cases such as this. It happens a
lot with attributes because of the "attribute:" syntax and
behavior. Otherwise "attribute:" would be useless if it error'd
on everything that isn't valid.
const int x = 37;
@safe int* p = cast(int*) &x; // ok
@safe: int* p = cast(int*) &x; // error
In the case of declarations, there usually aren't that many
littered about. So instead of having it be silent giving an error
message would be better. Sure it's still a "special" rule, but
it's not one that will silently jump out at you like in the above
case.
More information about the Digitalmars-d-announce
mailing list