Bitmask Event Wrapper

Wrap an integer flag set handed up from a lower layer in a single-field value class exposing contains and containsAny, so call sites stop writing raw bitwise tests against library constants. Covers keeping the wrapper allocation-free, why the flag constants must travel with it, the difference between "any of these bits" and "all of these bits", and what happens when a non-flag constant is passed to a flag test. Use when the same bitwise expression is copied across call sites, when a flag test is written as an equality check, or when a wrapper type exists but nothing ever calls it.

maxrave-dev b8e3c93 8.4 KB Updated

File contents

maxrave-dev/kotlin-footguns/tree/main/skills/bitmask-event-wrapper commit b8e3c937e5

Frequently asked questions

npx skillmds@latest add maxrave-dev/bitmask-event-wrapper