Re:A Bit Overcomplicated
by BulgarianIdiot on Thursday August 05, 2021 @07:18PM
(#28081327)
What you're saying: "In practice good modern API design prefers explicit intent over low-level details like exposing bitshifting for flags"
What people are saying to you: "You say bitshifting is complex, so if I say bitshifting is simple, it means I'm smarter than you"
>"so if I say bitshifting is simple, it means I'm smarter than you"
To BulgarianIdiot: This is quite a conclusion.
>"Doesn't hurt to know it, sure, but it's entirely not useful for a large majority of developers these days"
I read about a lot of things that are not immediately useful for me. Still somehow it falls into nooks and crannies of my brain and helps me to solve various problem when / if need arises. I do not even remember the exact things but general understanding of what is available and how does it functions approximately. If I need details Google does the rest.
>"It's a lot easier to understand:
display.disable();"
No arguments about this one. Even though I do work with bits sometimes I wrap those into something digestible like your example. Inlining helps not to use performance when it is needed.
Something like:
Or even: Is not immediately clear what is going on (other than some masking and shifting is happening), and these are simple cases without a lot going on. To understand these operations, we have to figure out what's significant about these numbers, what the variables might be here, etc.It's a lot easier to understand:
Which is what most higher-level-language developers (web, apps, even backend, and more) will use and expect to find in a codebase.