On Saturday, 16 June 2018 at 13:52:37 UTC, Jacob Shtokolov wrote:

Is it possible to introduce a new parameter/flag to the compiler, to force all functions be @safe by default on a per-module basis?

Forgive me if you're already aware of this, but to ensure your entire program is `@safe` (assuming it's single threaded) you only need to attribute `main` with `@safe`. This is because `@safe` functions cannot call unsafe functions and will emit a compiler error if attempting to do so.

You still may need to attribute called functions with `@safe` or `@trusted` as necessary, and as others have already explained, but your program will enforce `@safe`ty simply by attributing `main`.

Mike


Reply via email to