洪 民憙 (Hong Minhee) :nonbinary:'s avatar
洪 民憙 (Hong Minhee) :nonbinary:

@hongminhee@hollo.social · Reply to jnkrtech's post

@jnkrtech That's a really interesting idea! The “greedy but respect defined handlers” approach would definitely be more user-friendly—no worrying about option order is a big win.

The challenge is that it would require a significant architectural change to how Optique currently works. Right now, parsing is a single-pass, left-to-right process where each parser consumes tokens as it encounters them. Your suggestion would need something like a two-pass system:

  1. First pass: scan all tokens and match against explicitly defined parsers
  2. Second pass: collect remaining unmatched tokens into passThrough()

This is doable, but it's a fairly fundamental shift from the current design. 🤔

I really like where you're going with this though. Let me spend some time thinking about whether there's a way to support this pattern without requiring a major redesign. Maybe there's a middle ground, or maybe the two-pass approach is worth it for the better DX.

And good luck convincing your team to switch! 🥰