`@getRuntimeSafety()`

gets the current runtime safety, so we can enable/disable custom safety checks.

Checking the build mode is less granular than zigs built-in safety checks.

Using a global or build options is as granular as you want/need, but its more obscure to users of your library.

A similiar proposal to this already exists:

If this gets accepted you could do this:

const mode = @import(@returnAddress(), "builtin").mode;

to get the optimization mode at the call site.

cool, but the optimisation mode only tells you the default release safety setting.

Maybe I’m misunderstanding the proposal, I don’t think it’s quite clear whether @import(@returnAddress(), "builtin") will return the default mode of the call site or the actual optimization mode set with @optimizeFor() which this proposal kind of depends on (at least the part about mixing optimization modes).

i miss remembered @optimizeFor proposal