Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The form of safety we are talking about here is not like rust's "safety", it does not color functions, and is strictly scoped to the compiled unit (in this case, function)

https://ziglang.org/documentation/master/#setRuntimeSafety



I am aware, my point is about how the following is dealt with:

  fn foo(x: i32) i32 {
      return x + 100;
  }
  fn bar(x: i32) i32 {
      @setRuntimeSafety(false);
      return foo(x + 100);
  }
Particularly when you have arbitrarily deep call graphs where some explicitly enable and disable runtime safety.


You mean overflow checking? It only applies to the `x + 100` in bar. Bar can still panic if the `x + 100` in foo overflows. Why should it be any other way?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: