zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Aleksandr Mezin <mezin.alexander@gmail.com>
Cc: zsh-workers@zsh.org
Subject: Re: [RFC PATCH v3] vcs_info: choose backend by basedir
Date: Wed, 4 Nov 2020 06:38:24 +0000	[thread overview]
Message-ID: <20201104063824.74110106@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <CADnvcfKwbzaKCjpvPjj-7sepvyYyq5CfSGwgC0pxofcTbz64bQ@mail.gmail.com>

Sorry for the delayed replies; I've been offline.  More below.

Aleksandr Mezin wrote on Mon, 02 Nov 2020 05:09 +0600:
> On Thu, Oct 29, 2020 at 7:28 AM Aleksandr Mezin
> <mezin.alexander@gmail.com> wrote:
> > It's possible to revert to the old behavior of vcs_info, by setting:
> >
> >     zstyle ':vcs_info:*' backend-choice enablement-order
> >  
> 
> Now I'm not sure if an "enum-like" zstyle is a good idea.
> 

Fair question.

> 1) Should I check somewhere that the string value is valid (i.e. it's
> either empty, or one of the predefined strings)?

(This question presumes we'll be keeping the enum-like design, so I'll
presume the same in my answer.)

If possible, please write the code so as to be forward compatible with
any new enum values we may add in the future.  That is, when reviewing,
we'll consider several cases:

- Style isn't set
- Style is set to one of the predefined strings
- Style is set to a string that will be predefined in a future version
  or to an invalid string (the code can't tell the difference)

Less likely cases include:

- The style is set to the empty array («zstyle $pattern $style» with no further arguments)
- The style is set to the empty string («zstyle $pattern $style ''»)
- The style is set to one of the predefined strings, plus some
  additional words

> 2) Extensibility: I don't think there will be another different mode
> that should be controlled by this zstyle. More likely, there will be
> parameters like "prefer non-ancestor vcs directories or not". And IMO
> they should have their own boolean zstyles, and not something like
> `backend-choice closest-vcs-dir-prefer-ancestors`. And even more
> likely, nobody will add anything there

About extensibility, needs for extensibility aren't always foreseen.

As to their own boolean styles, I'm not sure I agree.  zstyle values are
arrays, so we could let parameters be provided in additional words, as
in:
.
    zstyle $pattern $style enablement-order foo=bar
    zstyle $pattern $style closest-.vcs-dir lorem=ipsum

Hmm.  Perhaps it would make more sense to name the style "disk-layout",
and then the extra parameters could be used to choose whether to select
the closest or farthest .${vcs} dir.

Or perhaps an enum really is overkill, as you say.

Frank?

Cheers,

Daniel


  reply	other threads:[~2020-11-04  6:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-29  1:27 Aleksandr Mezin
2020-10-29  2:26 ` Frank Terbeck
2020-10-30  6:55   ` Aleksandr Mezin
2020-10-30 16:47     ` Daniel Shahaf
2020-11-01 23:09 ` Aleksandr Mezin
2020-11-04  6:38   ` Daniel Shahaf [this message]
2020-11-05  0:50     ` Aleksandr Mezin
2020-11-05 14:49       ` Daniel Shahaf
2020-11-09 16:11         ` Aleksandr Mezin

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=20201104063824.74110106@tarpaulin.shahaf.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=mezin.alexander@gmail.com \
    --cc=zsh-workers@zsh.org \
    /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://git.vuxu.org/mirror/zsh/

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).