• calcopiritus@lemmy.world
    link
    fedilink
    arrow-up
    3
    arrow-down
    1
    ·
    6 kuukautta sitten

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

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

    • taladar
      link
      fedilink
      arrow-up
      7
      ·
      6 kuukautta sitten

      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).