r/programming • • Oct 06 '25

[deleted by user]

[removed]

155 Upvotes

218 comments sorted by

View all comments

Show parent comment

2

u/davidalayachew Oct 08 '25

Wow, Java has bitmasks? What a revolutionary feature. If only Rust had that. /s

The real trick is not the bitmasks, but being able to know at compile time exactly how many instances are ever going to be created (and thus, how many bits the bitmask needs).

That is the powerful part because we can skip an entire class of validation checks -- that is the performance benefit that Rust can't get, as they chose to enumerate their types rather than their instances of the types.