• SorteKanin@feddit.dkOP
    link
    fedilink
    arrow-up
    2
    ·
    5 days ago

    Macros are often not very ergonomical to use compared to language features.

    Also, why anonymous product types but not anonymous sum types? It seems kind of weird to me. Anonymous sum types can be just as useful as anonymous product types, as the blog post illustrates quite well I think.

    • TehPers@beehaw.org
      link
      fedilink
      English
      arrow-up
      2
      ·
      edit-2
      4 days ago

      While I agree with you that anonymous sum types are useful, the language designers tend to avoid anything that might include a hidden cost (in this case either the size of the enum or cost of boxing). Something along those lines might end up in the language eventually, though.

    • BB_C@programming.dev
      link
      fedilink
      arrow-up
      1
      ·
      4 days ago

      The language wouldn’t have lost much without tuples actually. But they do at least have direct pattern destructuring utility. Anonymous enums don’t.

      They also don’t pose potential future awkwardness if/when variant types become a thing.