Re: Microproject idea: new OPT_* macros for PARSE_OPT_NONEG

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: Microproject idea: new OPT_* macros for PARSE_OPT_NONEG

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:00:18

Duy Nguyen [off-list ref] writes:
On Sat, Mar 8, 2014 at 2:20 AM, Junio C Hamano [off-list ref] wrote:
quoted
Looking at "git grep -B3 OPT_NONEG" output, it seems that NONEG is
associated mostly with OPTION_CALLBACK and OPTION_SET_INT in the
existing code.

Perhaps OPT_SET_INT should default to not just OPT_NOARG but also
OPT_NONEG?
There are OPT_SET_INT() that should not have NONEG in current code. So
there are two sets of SET_INT anyway. Either we convert them all to a
new macro that takes an extra flag, or we add OPT_SET_INT_NONEG() that
covers one set and leave the other set alone.
Are you forgetting the third alternative, of swapping the default,
if the ones that do not want NONEG are in the minority, to reduce
the number of spelled-out instances?

Re: Microproject idea: new OPT_* macros for PARSE_OPT_NONEG

From: Duy Nguyen <hidden>
Date: 2016-06-15 23:00:19

On Fri, Mar 14, 2014 at 2:00 AM, Junio C Hamano [off-list ref] wrote:
Duy Nguyen [off-list ref] writes:
quoted
On Sat, Mar 8, 2014 at 2:20 AM, Junio C Hamano [off-list ref] wrote:
quoted
Looking at "git grep -B3 OPT_NONEG" output, it seems that NONEG is
associated mostly with OPTION_CALLBACK and OPTION_SET_INT in the
existing code.

Perhaps OPT_SET_INT should default to not just OPT_NOARG but also
OPT_NONEG?
There are OPT_SET_INT() that should not have NONEG in current code. So
there are two sets of SET_INT anyway. Either we convert them all to a
new macro that takes an extra flag, or we add OPT_SET_INT_NONEG() that
covers one set and leave the other set alone.
Are you forgetting the third alternative, of swapping the default,
if the ones that do not want NONEG are in the minority, to reduce
the number of spelled-out instances?
There are 12 SET_INT with NONEG and 81 without (though I suspect some
of them should have NONEG). So NONEG is not exactly the majority. And
swapping does not go well with git development style, some in-flight
topics may introduce new OPT_SET_INT() that uses the old behavior.


-- 
Duy
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help