git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v1 3/4] advice: remove uses of global `advice_` variables

From
Ben Boeckel <mathstuf@gmail.com>
Date
Aug 3, 2021, 00:42 UTC
Message-ID
<YQiRD2OA08iW2cx7@erythro.dev.benboeckel.internal>
In-Reply-To
<nycvar.QRO.7.76.6.2108022356300.55@tvgsbejvaqbjf.bet>
On Tue, Aug 03, 2021 at 00:06:48 +0200, Johannes Schindelin wrote:
Show 11 quoted lines
> On Fri, 30 Jul 2021, Ben Boeckel wrote:
> > There are now function APIs to access this information, so the global
> > variables are no longer needed to communicate their values.
> 
> This commit message implies that the reader remembers that `hw/advise-ng`
> introduced a new advice API with the express intent to eventually replace
> those global `advice_*` variables.
> 
> However, it is not the responsibility of the reader to remember that. It
> is the responsibility of the commit message to describe this (so that the
> reader can either remember it, or learn about it in the first place).

That makes sense, thanks. I guess I'm used to projects where I'm at least peripherally aware of most of what's going on, but that's because I work on cross-cutting concerns on them for the most part (build systems, CI, software process).

> Now, as for the diff, I can guess just how tedious all of the
> semi-repetitive `advice_*` -> `advice_enabled(ADVICE_*)` changes were from
> trying to verify that they are all correct.

One of the times a case-insensitive word diff rendering would be handy. (Then letting the compiler verify that the new side actually works.)

> Big thank you for that!
You can thank this Vim macro which made the tedious bits trivial:
    iadvice_enabled(<Esc>wgUwea)<Esc>]q
Show 11 quoted lines
> However, even reading through the diff the second time, I managed to miss
> the subtlety that there were two `advice_set()` calls strewn in.
> 
> As I pointed out in my review of patch 1/4, I would much prefer to have
> the addition of those callers in 1/4 along with the introduction of said
> function.
> 
> However, now that I write this, I would like to correct my advice (pun
> intended) from 1/4 to leave the removal of the assignment of the global
> `advice_*` variables here: It would make much more sense to move them to
> patch 4/4.

Sounds good. I'll still keep it as a separate patch, but just have one for the read-only side, then a new patch which adds the write API and transforms the 2 write instances. The final patch can then stay the same. In short:

  - 2/4 (read-only bits) -> v2 1/4
  - 3/4 -> v2 2/4
  - 1/4 + 3/4 (write bits) -> v2 3/4
  - 4/4 -> mostly the same
Thanks,
--Ben
Previous: Johannes SchindelinNext: Ben Boeckel
Message 9 of 32 in “advice: remove usage of `advice_*` global variables”
  1. 0/4 advice: remove usage of `advice_*` global variablesBen Boeckel, Jul 31, 2021
  2. 1/4 advice: add a function to set the value of an advice typeBen Boeckel, Jul 31, 2021
  3. Johannes SchindelinAug 2, 2021
  4. 2/4 advice: add enum variants for missing advice variablesBen Boeckel, Jul 31, 2021
  5. Johannes SchindelinAug 2, 2021
  6. Ben BoeckelAug 3, 2021
  7. 3/4 advice: remove uses of global `advice_` variablesBen Boeckel, Jul 31, 2021
  8. Johannes SchindelinAug 2, 2021
  9. Ben BoeckelAug 3, 2021
  10. 4/4 advice: remove static global variables for advice trackingBen Boeckel, Jul 31, 2021
  11. Johannes SchindelinAug 2, 2021
  12. Ben BoeckelAug 3, 2021
  13. Johannes SchindelinAug 2, 2021
  14. Ben BoeckelAug 3, 2021
  15. 0/4 advice: remove usage of `advice_*` global variablesBen Boeckel, Aug 5, 2021
  16. 1/4 advice: add enum variants for missing advice variablesBen Boeckel, Aug 5, 2021
  17. 2/4 advice: remove read uses of global `advice_` variablesBen Boeckel, Aug 5, 2021
  18. 3/4 advice: add `advice_set` to update advice settings at runtimeBen Boeckel, Aug 5, 2021
  19. 4/4 advice: remove static global variables for advice trackingBen Boeckel, Aug 5, 2021
  20. 0/4 advice: remove usage of `advice_*` global variablesÆvar Arnfjörð Bjarmason, Aug 6, 2021
  21. 2/4 advice: remove read uses of most global `advice_` variablesÆvar Arnfjörð Bjarmason, Aug 6, 2021
  22. Eric SunshineAug 6, 2021
  23. 1/4 advice: add enum variants for missing advice variablesÆvar Arnfjörð Bjarmason, Aug 6, 2021
  24. 3/4 advice: remove use of global advice_add_embedded_repoÆvar Arnfjörð Bjarmason, Aug 6, 2021
  25. Eric SunshineAug 6, 2021
  26. 4/4 advice: move advice.graftFileDeprecated squashing to commit.[ch]Ævar Arnfjörð Bjarmason, Aug 6, 2021
  27. 0/4 advice: remove usage of `advice_*` global variablesÆvar Arnfjörð Bjarmason, Aug 23, 2021
  28. 1/4 advice: add enum variants for missing advice variablesÆvar Arnfjörð Bjarmason, Aug 23, 2021
  29. 2/4 advice: remove read uses of most global `advice_` variablesÆvar Arnfjörð Bjarmason, Aug 23, 2021
  30. 3/4 advice: remove use of global advice_add_embedded_repoÆvar Arnfjörð Bjarmason, Aug 23, 2021
  31. 4/4 advice: move advice.graftFileDeprecated squashing to commit.[ch]Ævar Arnfjörð Bjarmason, Aug 23, 2021
  32. Junio C HamanoAug 25, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.