• calcopiritus@lemmy.world
    link
    fedilink
    arrow-up
    3
    arrow-down
    1
    ·
    15 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
      7
      ·
      15 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).