argparse version 0.7.0 - a CLI parsing library

H. S. Teoh hsteoh at quickfur.ath.cx
Fri Mar 18 21:15:34 UTC 2022


On Fri, Mar 18, 2022 at 06:21:46PM +0000, Anonymouse via Digitalmars-d-announce wrote:
> On Thursday, 17 March 2022 at 19:07:28 UTC, H. S. Teoh wrote:
> > Using independent, orthogonal UDAs may make option specification
> > using your module easier to read. For example, from your docs:
[...]
> > It might also simplify your implementation by having more smaller,
> > independent pieces for each UDA instead of a single complex UDA that
> > handles everything.
> 
> I use UDAs extensively in my project and I've historically been doing
> the multiple-UDA approach you describe. Upon seeing argparse a few
> months back I started rewriting it to use a single UDA, and I found it
> allowed for a simpler implementation (and not the other way around).
> 
> The immediate gains boiled down to that I could now pass what is
> essentially a context struct around at CTFE instead of keeping track
> of multiple variables. Default values are also much easier to manage
> with much fewer `hasUDA`s sprinkled everywhere.

Hmm, interesting indeed!  I should experiment with both approaches to
do a fairer comparison.


T

-- 
Век живи - век учись. А дураком помрёшь.


More information about the Digitalmars-d-announce mailing list