Ralith / hecs

A handy ECS
Apache License 2.0
921 stars 79 forks source link

flipped entities repr for ordering #357

Closed sanbox-irl closed 3 months ago

sanbox-irl commented 7 months ago

needed, fulfills #317.

fwiw -- i feel pretty iffy about changing the bit repr. I know that hecs says that it "doesn't promise anything" but this library is used a lot! personally, i'd leave the old bit repr in place

Ralith commented 7 months ago

What if we deem it a breaking change? We could just tinker with the Ord impl, but that might have similar risks anyway.

sanbox-irl commented 7 months ago

If you're comfortable with that, I'm comfortable with that, but I'd say that the Ord change is "higher level" than the bit fiddling changes, so it feels simpler to understand.

sanbox-irl commented 7 months ago

I have a clearer answer now why i don't support the bit flipping -- adjusting the Ord is useful for users and simply makes more sense. Adjusting the bit encoding, on the other hand, does very little IMO except seem sensible in some obscure "the representation in bits should match the structs layout", which we aren't really committing to ofc, since we're handling the casting from struct to u64. As a result, changing the ord is sensible for users and purely better, so it's worth the breakage. Changing the bit repr, on the other hand, has no motivation to me except to make ord and bit's ord stay aligned, which is imo a non-goal

sanbox-irl commented 6 months ago

@Ralith bumpin this for your thoughts