git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "René Scharfe" <l.s.r@web.de>
To: Taylor Blau <me@ttaylorr.com>
Cc: git@vger.kernel.org, gitster@pobox.com
Subject: Re: [PATCH 0/2] grep: introduce and use grep_and_expr()
Date: Fri, 7 Jan 2022 20:54:16 +0100	[thread overview]
Message-ID: <ec92e2ec-ef0a-8fe3-abcb-5cc6b29de762@web.de> (raw)
In-Reply-To: <YdiVmgJYPzVrIYE1@nand.local>

Am 07.01.22 um 20:33 schrieb Taylor Blau:
> On Fri, Jan 07, 2022 at 01:57:17PM +0100, René Scharfe wrote:
>> Am 06.01.22 um 20:50 schrieb Taylor Blau:
>>> René,
>>>
>>> Here are a couple of extra patches on top of your series which introduce
>>> and use a new grep_and_expr() function.
>>>
>>> Like the final patch says, this isn't about reducing code duplication,
>>> but rather about adding visual consistency with the other
>>> `compile_pattern_xyz()` functions.
>>>
>>> Taylor Blau (2):
>>>   grep: extract grep_binexp() from grep_or_expr()
>>
>> I considered extracting such a function as well.  I'd have called it
>> grep_binary_expr(), though, to match the existing names.
>>
>> I decided against it because it can be misused by passing a non-binary
>> kind to it.  (That's a weak objection, but the benefit of such a
>> function was low already in my mind because it doesn't do much.)  You
>> solve this by keeping grep_or_expr() and adding grep_and_expr(), which
>> cannot be misused in this way -- OK.

That "OK" should probably have been a "Good".

>
> That makes sense. If it's keeping you up at night, we could easily add a
> check to ensure that `kind` is one of GREP_NODE_OR or GREP_NODE_AND. But
> I think that any new code that looks like:
>
>     grep_binexp(GREP_NODE_NOT, xyz, NULL);
>
> would probably stick out like a sore thumb. So I doubt that such a check
> would buy us much practically speaking.

Having the wrappers for all the binary node types is good enough.  I'm
not so sure about the sticking out thing -- I managed to miss bigger
mistakes before..

> But I agree that this whole thing probably isn't worth the minimal
> effort required, since the couple of patches I posted on top are purely
> about cosmetics.
>
> All of that is to say that I'd be happy to see these patches picked up,
> and I would also not be sad at all to see them left on the floor.

I think the end result is an improvement.

René

      reply	other threads:[~2022-01-07 19:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-06  9:51 [PATCH 1/2] grep: use grep_or_expr() in compile_pattern_or() René Scharfe
2022-01-06  9:54 ` [PATCH 2/2] grep: use grep_not_expr() in compile_pattern_not() René Scharfe
2022-01-06 19:50 ` [PATCH 0/2] grep: introduce and use grep_and_expr() Taylor Blau
2022-01-06 19:50   ` [PATCH 1/2] grep: extract grep_binexp() from grep_or_expr() Taylor Blau
2022-01-06 19:50   ` [PATCH 2/2] grep: use grep_and_expr() in compile_pattern_and() Taylor Blau
2022-01-06 22:14     ` Junio C Hamano
2022-01-06 22:43       ` Taylor Blau
2022-01-06 22:42   ` [PATCH v2 0/2] grep: introduce and use grep_and_expr() Taylor Blau
2022-01-06 22:42     ` [PATCH v2 1/2] grep: extract grep_binexp() from grep_or_expr() Taylor Blau
2022-01-06 22:42     ` [PATCH v2 2/2] grep: use grep_and_expr() in compile_pattern_and() Taylor Blau
2022-01-07 12:57   ` [PATCH 0/2] grep: introduce and use grep_and_expr() René Scharfe
2022-01-07 19:33     ` Taylor Blau
2022-01-07 19:54       ` René Scharfe [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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ec92e2ec-ef0a-8fe3-abcb-5cc6b29de762@web.de \
    --to=l.s.r@web.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=me@ttaylorr.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).