how much "real-life" code can be marked @safe ?
Alexandru Ermicioi
alexandru.ermicioi at gmail.com
Fri Jul 2 08:04:10 UTC 2021
On Friday, 2 July 2021 at 00:26:52 UTC, someone wrote:
> ... just wondering:
> ...
Imho, if you want all of the app to be safe, and you cannot avoid
unsafe code, then there are two choices:
1. Mark the method doing unsafe stuff as @trusted, or pieces of
code which are unsafe with trusted lambda hack.
2. Mark the top caller of your @system methods as @trusted.
In both cases, unsafe code should be manually checked as best as
it can be done. Best is to think twice whether you can redesign
your code to avoid unsafe operations.
On PR review step if there is such thing for your app, reviewers
should carefully review those @trusted blocks of code.
Oh well, and tests, tests and more tests, i.e. It should be
thoroughly tested.
Best regards,
Alexandru.
More information about the Digitalmars-d-learn
mailing list