On 11/21/2026 8:47 PM, Lawrence D’Oliveiro wrote:
> On Sat, 21 Nov 2026 20:25:26 -0500, Arne Vajhøj wrote: >
>> Java has both bitwise & and | on integer types and logical & and | >> on booleans. >> >> In C and Python bool are sort of an int so bitwise and logical are >> the same.
> > Python treats bool as a subclass of int. (Yes, you can subclass int.) > > Java tries to treat them as entirely separate types, which is not > necessarily a bad thing on its own,
We are some that like type safety. :-)
> but then it doesn’t provide > natural conversions between them. Like being able to use bool for > indexing arrays, just for example.
It would have to be a[bv ? 1 : 0] or use a Map<Boolean,X> instead of X[]. Arne