DIP 1028 "Make @safe the Default" is dead
Steven Schveighoffer
schveiguy at gmail.com
Fri May 29 12:22:07 UTC 2020
On 5/29/20 12:53 AM, Walter Bright wrote:
> The subject says it all.
>
> If you care about memory safety, I recommending adding `safe:` as the
> first line in all your project modules, and annotate individual
> functions otherwise as necessary. For modules with C declarations, do as
> you think best.
>
> For everyone else, carry on as before.
Thank you Walter.
I'm sure this was not easy to decide, and is frustrating. It's
unfortunate that the thrust of DIP1028 could not be saved and we had to
throw out the whole thing for the one bad piece.
It would be nice to be able to put @safe: at the top of all modules.
This was in fact the first thing I tried when migrating the mysql-native
package to be @safe compliant [1]. And it did work for a few modules
quite well. There are a few snags though:
1. Templates should be inferred rather than stamped @safe
2. Class methods do not inherit this attribute
So I think @safe by default (for D-compiled code) would be ideal and
provide the most utility.
-Steve
[1] https://github.com/mysql-d/mysql-native/pull/214
More information about the Digitalmars-d-announce
mailing list