Comment by tialaramex

6 days ago

Having observed that this is true, a good designer would see Rust's Editions and seize upon this as a useful, even necessary idea for a language intended to last for more than a few years.

In 2019 P1881 "Epochs" https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p18... was instead given the usual treatment by WG21, Vittorio was told it would be very difficult, numerous obstacles were identified and he was told to go away and solve them (implied: and if you come back we'll find more).

That paper was written after Rust's 2018 Edition (and of course the Rust 1.0 "2015 Edition" implied by the implementation of editions) but since then 2021 Edition and 2024 Edition both landed significant further improvements.

A challenge:

In the below code snippet, that it is assumed was gotten on GitHub or a documentation site or somewhere else, you are not allowed to figure out which edition the code is meant for. You must tell, without knowing the edition, whether the code has a deadlock or not. You may not assume a specific edition.

fn f(value: &RwLock<Option<bool>>) {

    if let Some(x) = *value.read().unwrap() {

        println!("value is {x}");

    } else {

        let mut v = value.write().unwrap();

        if v.is_none() {

            *v = Some(true);

        }

    }

}

If you are not able to, you must delete all your social media accounts and never comment on any topic related to programming languages or Rust ever again.

  • In my point of view, editions do not achieve much more than a plain -std=langXY, alongside clang-tidy, or equivalent depending on the compiler, or AI based tool.

    Because they don't support as many language and standard library evolution scenarios, as many think they do.