From: Pranit Bauva <pranit.bauva@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [PATCH/RFC] parse-options.c: make OPTION__COUNTUP consider negative values
Date: Sun, 20 Mar 2016 14:37:01 +0530 [thread overview]
Message-ID: <CAFZEwPM2XZzGuVBRoQt1e8uVvfd3_b9h2-j+vCe3XymW6kjRsg@mail.gmail.com> (raw)
In-Reply-To: <20160320041009.GA18312@sigill.intra.peff.net>
On Sun, Mar 20, 2016 at 9:40 AM, Jeff King <peff@peff.net> wrote:
>> > We are also changing semantics without changing the interface, which
>> > means any topics in flight (that you _cannot_ review, because you have
>> > not seen them yet) may be subtly broken. To me that is not an absolute
>> > deal-breaker, but something to weigh against the utility of the change.
>>
>> As I am new here, I don't really know how to go about with this. Could
>> you describe in a little detail so that I can work on it?
>
> A more canonical example is changing a function return value. Imagine I
> have a function which returns "1" for success and "0" for error, and I
> want to change it to return "0" for success and "-1" for error. If I do
> so and update each caller, then merging with a branch that has a new
> caller will not result in any conflicts (there is no textual link
> between the callers and the function), but the result will be subtly
> broken (the new caller will get the error-check wrong).
>
> So we generally try to find some way that the compiler will notice the
> breakage. E.g., if the function changes name when the return value
> semantics change, or if it gains a new argument at the same time, then
> the compiler will notice and complain. We still have to fix it up during
> the merge, of course, but it's easy to spot.
>
> Likewise here. If you change the semantics of OPT_COUNTUP(), then any
> branch which introduces a new use of "int foo = -1" and expects the old
> semantics will be subtly broken.
>
> The obvious fix would be to switch the name (to OPT_COUNTUP_DEFAULT() or
> something). But that's a bit painful, as almost nobody uses COUNTUP
> directly, so we'd need OPT__VERBOSE_DEFAULT().
This is quite new to me. It took me some time to digest it.
> Which in the end is the same as ignoring the problem in the first place,
> but there is a big difference between not thinking about the problem,
> and thinking about it and deciding it's not a problem. :)
True That! ;)
Regards,
Pranit Bauva
prev parent reply other threads:[~2016-03-20 9:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-16 23:16 [PATCH/RFC] parse-options.c: make OPTION__COUNTUP consider negative values Pranit Bauva
2016-03-17 1:50 ` Jeff King
2016-03-17 7:28 ` Eric Sunshine
2016-03-17 8:14 ` Eric Sunshine
2016-03-17 20:22 ` Pranit Bauva
2016-03-18 11:23 ` Pranit Bauva
2016-03-20 4:10 ` Jeff King
2016-03-20 9:07 ` Pranit Bauva [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFZEwPM2XZzGuVBRoQt1e8uVvfd3_b9h2-j+vCe3XymW6kjRsg@mail.gmail.com \
--to=pranit.bauva@gmail.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).