zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Roman Perepelitsa <roman.perepelitsa@gmail.com>
Cc: Marlon Richert <marlon.richert@gmail.com>,
	Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Does add-zle-hook-widget violate the contract of ZLE hook widgets?
Date: Thu, 24 Jun 2021 18:54:19 +0000	[thread overview]
Message-ID: <20210624185419.GB16386@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <CAN=4vMrEX0XhYiLV1HPswRNScQ=VLqkw=6txPZ0TJ0fKYiCv+w@mail.gmail.com>

Roman Perepelitsa wrote on Thu, Jun 24, 2021 at 12:45:53 +0200:
> On Thu, Jun 24, 2021 at 12:34 PM Marlon Richert
> <marlon.richert@gmail.com> wrote:
> >
> > [...] the documentation in
> > https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html#Special-Widgets
> > could be updated to guide the user towards azhw.
> >
> > [...] 3rd-party developers should be strongly
> > encouraged to use azhw and not zle -N zle-X.
> 
> [*] This thread, workers/49084 and workers/49085.

Let's break this down.

This thread is about the fact that a-z-h-w has an «if (( $? )); then
break; fi» in its "loop over all registered hooks and call each in turn"
code.  It has had that check since its first release, and whatever
semantics we desire are easy to implement.  It's not a big deal.

workers/49084 is an edge case involving pre-azhw code trying to wrap
azhw.  It's a teething problem, and shouldn't be too hard to fix.

I haven't fully digested workers/49085, but its author does say there
that a fix is "not too difficult".

> Given the current state of add-zle-hook-widget [*] I would be wary of
> giving this advice. I personally never use it and cannot recommend
> anyone to use it. If your goal is to write a robust plugin that is
> unlikely to break in the presence of other plugins,
> add-zle-hook-widget is a poor choice.
> 

It's not clear to me why you're raising the alarm bells against uses of
a-z-h-w, for two reasons:

One, the specific bugs you cite seem to be easy to fix and uncommon to
run into (they haven't been run into in the 4+ years since a-z-h-w's
first release).

Two, you don't discuss alternatives.  The conclusion "Don't use a-z-h-w"
does not follow from the premise "a-z-h-w has bugs".  It might follow
from a proposition of the form "a-z-h-w is worse than the alternative",
but that was not argued — and, _prima facie_, it's easier to write bugs
without a-z-h-w than with it.

> Roman.
> 


  reply	other threads:[~2021-06-24 18:54 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-23 20:30 Marlon Richert
2021-06-23 21:57 ` Daniel Shahaf
2021-06-23 23:33   ` Lawrence Velázquez
2021-06-24  0:09     ` Daniel Shahaf
2021-06-24 10:34   ` Marlon Richert
2021-06-24 10:45     ` Roman Perepelitsa
2021-06-24 18:54       ` Daniel Shahaf [this message]
2021-06-24 19:51         ` Roman Perepelitsa
2021-06-24 18:30     ` Daniel Shahaf
2021-06-24 21:48       ` Marlon Richert
2021-06-24 22:29         ` Lawrence Velázquez
2021-06-26 10:12           ` Marlon Richert
2021-06-26 14:51             ` Bart Schaefer
2021-06-24 23:52         ` Daniel Shahaf
2021-06-26 10:49           ` Marlon Richert
2021-06-25 17:34         ` Bart Schaefer
2021-06-27  8:19 Marlon Richert
2021-06-29  2:06 ` Bart Schaefer
2021-06-29 14:50   ` Marlon Richert

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=20210624185419.GB16386@tarpaulin.shahaf.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=marlon.richert@gmail.com \
    --cc=roman.perepelitsa@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).