• stetech@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    1 个月前

    You cannot make a safe yet universal cutting tool.

    I’m neither language designer or crustacean advocate, but from what can be read, Rust seems to have managed just fine. The trick is probably to allow removing the cover of the sharp edge when needed (execute unsafe).

    • Fonzie!@ttrpg.network
      link
      fedilink
      English
      arrow-up
      2
      ·
      20 天前

      Also, Rust allows “unsafe” code for when it’s absolutely necessary; you DO need to add a line that basically says “I know compiler, don’t stop me”. To keep up the metaphor; Rust allows you to cut yourself with the knife, but ensures you’re fully aware of what you’re doing.