Andrew Hunt <andy / Toolshed.Com> writes: > >But in Ruby, there's no overwrap between Fixnums and Bignums (on > >purpose), so that > > > > 1073741823[2] = 1 # error! Fixnum > > 1073741824[2] = 1 # ok! Bignum > > > >would be confusing. I think we should introduce BitArray or something > >for that purpose. > > It wouldn't be so confusing if you could explictly create > a new Bignum: > > bucket = Bignum.new(200) > > Could make a bit array starting off as 200 bytes long. I suppose > it could be accidently coerced to a Fixnum if it were too small, > but I'd rather see bit access as part of the existing classes > instead of creating another one if possible. Or.. how about a class BitSet that had proper bit operators ([]=, plus all the shifts, xors, and the like) that could be converted back and forth between itself and Integer. That way, you'd have the bit class for bit semantics, but which made no promises about arithmetic, but which could morph into a Fixnum or Bignum as appropriate. That seems cleaner to me. Dave