Replies: 2 comments 3 replies
-
It's a bit conflicting indeed. Mostly it's a bitvector with explicit resizing, except for get/set/reset. You make a good point about the equality part, maybe it should just compare set bits. It's not released yet so we can break it still :-) |
Beta Was this translation helpful? Give feedback.
3 replies
-
referenced in #375 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I feel there might be two incompatible design principles in the current
CCBV
module:CCBV.t
is a collection of true bits that resizes likeHashtbl
.CCBV.t
is a vector of bits without automatic resizing.I think either is fine, and to be honest I don't have a preference, but mixing them up could eventually lead to confusion. In particular, resizing in
set
,flip
, ... and the interface of the currentempty
makes sense under the first principle, while the new equality only makes sense under the second principle. It is possible that by setting and resetting some high bit you would end up with a different vector due to resizing, and I feel this could be confusing. It seems to me the current design is closer to the first principle. If so, perhaps it makes more sense to do implicit resizing inequal
(by checking whether all the extra integers are zeros) and perhaps addhash
and other conversion functions that would ignore all the padding zeros.As a comparison, the
Bitv
library sticks to the second principle and does not automatically resize vectors; you can specify the length inof_list
, there's noempty
that serves as the "polymorphic empty collection", and bitwise operators are only defined for vectors of the same length. Arguably this is more efficient but I doubt this could be a bottleneck.Beta Was this translation helpful? Give feedback.
All reactions