@hongminhee@hollo.social

Here's a API design challenge I'm working on: adding async support to (CLI argument parser) without breaking the existing sync API.

The tricky part is combinators—when you compose parsers with object() or or(), the combined parser should automatically become async if any child parser is async, but stay sync if all children are sync. This “mode propagation” needs to work at both type level and runtime.

I've prototyped two approaches and documented findings. If you've tackled similar dual-mode API designs, I'd love to hear how you approached it.

https://github.com/dahlia/optique/issues/52

github.com

Support both sync and async modes for `Parser` and `ValueParser` · Issue #52 · dahlia/optique

I'm glad to see https://optique.dev/concepts/completion#custom-value-parser-suggestions but in some cases it may not be ideal to force the values to be retrieved synchronously. It would be nice to ...

1 reaction with ❤️