Hacker News new | ask | show | jobs
by kevincox 2042 days ago
Maybe `pure`. Then it is fairly straightforward to explain that the computation of `const` values must be `pure`.
1 comments

Fun fact: Rust did use "pure" a very long time ago... https://news.ycombinator.com/item?id=24295941

It has its own challenges. Consider:

  const fn foo(x: &mut i32) {
      *x += 1;
  }
would you consider this function pure? I don't think many would. Also, it may be pure given Rust's semantics, but it kinda goes against the intuitive, usual way people talk about purity, so that makes it hard.

(This is not yet stable in Rust, but will be.)