• zea
    link
    fedilink
    arrow-up
    4
    ·
    10 hours ago

    If you made it static, sure, but right now you’re living compiler error

    • bi_tux@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      1 hour ago

      oh well, I’m just starting to learn the language and come from java, so I thought: wait, it can’t be static

      • zea
        link
        fedilink
        arrow-up
        1
        ·
        10 minutes ago

        const is more like C++ constexpr, but static is similar to static from C: it’s a variable that lives outside any scope. Of course, that means the same static can be accessed by multiple threads, so writing to a static is unsafe (except for types like Mutex, you can safely use those to write, but your static won’t be declared mut)