• TehPers@beehaw.org
    link
    fedilink
    English
    arrow-up
    7
    ·
    7 days ago

    This doesn’t represent the mutual exclusivity through the type system (which is what the article is all about).

    I love clap and I use it a lot, but the only way to represent the exclusivity through the type system in Rust is through an enum.

    • ExFed@programming.dev
      link
      fedilink
      arrow-up
      4
      ·
      7 days ago

      Agreed. As nice as clap is, it’s not a combinator. Parser combinators have a the really nice feature of sharing the same “shape” as the data they parse, which makes them trivial to generate from a schema … or to just use them to represent your schema in the first place ;) .