[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANiq72mJDQaQsrWeeUhwoU1neQKOQnqqqo-5OvQ5kTG4citH+A@mail.gmail.com>
Date: Sat, 3 Jan 2026 15:00:21 +0100
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Kari Argillander <kari.argillander@...il.com>
Cc: Daniel Almeida <daniel.almeida@...labora.com>, Filipe Xavier <felipeaggger@...il.com>,
Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>, Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
Danilo Krummrich <dakr@...nel.org>, rust-for-linux@...r.kernel.org, felipe_life@...e.com,
linux-kernel@...r.kernel.org, Lyude Paul <lyude@...hat.com>
Subject: Re: [PATCH v7] rust: add new macro for common bitmap operations
On Sat, Jan 3, 2026 at 2:15 AM Kari Argillander
<kari.argillander@...il.com> wrote:
>
> But probably there is no point continue discussion as two people has nacked
> my suggestion so fast and I'm totally ok with it. Still thanks for
> taking time on this.
In general, I think it is a good point, i.e. I agree that abusing
custom operators everywhere isn't great, just like having a lot of
macros with custom, non-obvious syntax isn't ideal.
For something like bitflags, however, it seems reasonable. I think it
is a balance. For instance, `.enable()` and `.toggle()` are common in
other domains especially with a single flag/concept as an argument,
but when working with bitflags developers will likely expect to be
able to use the usual expressions they are accustomed to, especially
in a context like the Linux kernel. And while the `|` approach would
be workable if you introduce more methods like the masking case etc.,
something else like `.toggle(A & B)` would be very, very confusing,
i.e. it is like going back to square one introducing custom syntax
again.
Thanks for raising the point -- it is always nice to consider more
viewpoints and having more reviews.
Cheers,
Miguel
Powered by blists - more mailing lists