Feedback Thread: DIP 1028--Make @safe the Default--Final Review
Dukc
ajieskola at gmail.com
Tue Mar 31 23:08:59 UTC 2020
On Wednesday, 25 March 2020 at 07:03:16 UTC, Mike Parker wrote:
> [snip]
There is still this issue, that was brought up at previous review
also:
Consider large amounts of legacy code modules that mix a lot of
templated and non-templated functions. Majority of the
non-templated functions are not `@safe`, but a many templates
rely on inferring safety based on their arguments. The code is
already tested to be reliable, and refactoring it to be @safe
would not be worth it.
This DIP, as it currently stands, would force the maintainers to
add `@system` function by function to the codebase, which can be
somewhat large effort. If the maintainers could just add
`@system:` to top of each module, the migration effort would be
greatly reduced. However, they can't because they rely on the
templates in the modules inferring `@safe` based on the arguments.
I recommend that the DIP proposes to avoid this problem somehow.
One possibility is proposing an alternative to `@system:` that
does not apply to templates. Another is proposing that by
default, regular functions would have their safety inferred the
same way it's inferred for templated functions (thanks to
Vladimir Panteleev for this idea -wouldn't have occured to me).
More information about the Digitalmars-d
mailing list