• calcopiritus@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    21 days ago

    I don’t understand what the advantages of const expressions are.

    Isn’t const { None } the same as just None?

    • taladar@sh.itjust.works
      link
      fedilink
      arrow-up
      0
      ·
      21 days ago

      const expressions are evaluated at compile time and can be used in locations where you would have to otherwise specify a literal (or something that amounts to a named literal like a const value).