Proposal: Remove Num superclass of Bits

Isaac Dupree ml at isaac.cedarswampstudios.org
Sun Oct 16 19:47:17 CEST 2011


On 10/16/2011 01:35 PM, Edward Kmett wrote:
> On Sun, Oct 16, 2011 at 1:45 AM, Isaac Dupree<
> ml at isaac.cedarswampstudios.org>  wrote:
>
>> As others observed, "one" is only useful for the "bit" method default, and
>> might be meaningless for an "instance () Bits" (whereas the rest of the
>> class makes sense for () as a zero-bit instance, albeit a use doesn't come
>> to mind).  Or, similarly to (), a bit-vector which contains its length
>> statically in its type: it would be simpler if length zero was just as valid
>> as any other length.  And it would be a bit strange to define 'one' as a
>> value equal to 'zero'.
>>
>>
> It isn't entirely meaningless it is just out of range. It is perfectly well
> defined for me to set the 200th bit of a 64 bit integer, it just doesn't do
> anything. ;) Similarly setting the 1 bit of () would result in (), since
> there are no bits to set.

Yep.  bit 0 === one.  I still want to hear counterarguments to "not 
enough people use 'bit 0' to give it a name".

(Also, in the case of numeric Bits, people might call it "1")

-Isaac



More information about the Libraries mailing list