Skip to content

Conversation

@lovesegfault
Copy link
Member

@lovesegfault lovesegfault commented Nov 26, 2025

Motivation

Convert the Verbosity enum from old-style typedef enum to modern
enum class with cleaner value names:

  • lvlError -> Verbosity::Error
  • lvlWarn -> Verbosity::Warn
  • lvlNotice -> Verbosity::Notice
  • lvlInfo -> Verbosity::Info
  • lvlTalkative -> Verbosity::Talkative
  • lvlChatty -> Verbosity::Chatty
  • lvlDebug -> Verbosity::Debug
  • lvlVomit -> Verbosity::Vomit

I also added ++/-- operators with clamping for verbosity adjustments, and
explicit casts where Verbosity is serialized to integers.

Context

Part-Of: #14658


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

Convert the Verbosity enum from old-style `typedef enum` to modern
`enum class` with cleaner value names:

- lvlError -> Verbosity::Error
- lvlWarn -> Verbosity::Warn
- lvlNotice -> Verbosity::Notice
- lvlInfo -> Verbosity::Info
- lvlTalkative -> Verbosity::Talkative
- lvlChatty -> Verbosity::Chatty
- lvlDebug -> Verbosity::Debug
- lvlVomit -> Verbosity::Vomit

Added ++/-- operators with clamping behavior for safe verbosity
adjustments. Added explicit casts where Verbosity is serialized
to integers for protocol compatibility.
@github-actions github-actions bot added new-cli Relating to the "nix" command store Issues and pull requests concerning the Nix store repl The Read Eval Print Loop, "nix repl" command and debugger fetching Networking with the outside (non-Nix) world, input locking labels Nov 26, 2025
Copy link
Contributor

@xokdvium xokdvium left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think this is a good idea, since it doesn't bring any practical benefits. There's nothing fundamentally wrong with plain enums other than namespacing and the occasional implicit conversion. New types can surely use enum classes, but this churn is too annoying to deal with for backports.

Btw the diff could be reduced by bringing the names into the global scope. This will provide the benefit of banning implicit conversions to ints without the churn:

using enum Verbosity;

@Ericson2314
Copy link
Member

Btw the diff could be reduced by bringing the names into the global scope. This will provide the benefit of banning implicit conversions to ints without the churn.

To be clear @xokdvium likes this, and I do too. I would be fine as is — we should definitely get enum struct. Doing it this was assuages the churn concerns while still getting us the main benefits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fetching Networking with the outside (non-Nix) world, input locking new-cli Relating to the "nix" command repl The Read Eval Print Loop, "nix repl" command and debugger store Issues and pull requests concerning the Nix store

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants