17695, "lydia-duncan", "[Library Stabilization] What to do about "limbs" in BigInteger?", "2021-05-12T20:10:00Z"
A limb is a concept from GMP representing the portion of a multi-precision number that fits in a single machine word (which can vary in number of bits used) and one that we explain nowhere in our own documentation (not even in our GMP documentation). Should we provide this information at all via the
bigint.get_limbn() methods? It seems like potentially an implementation detail, but I could also see it being relevant to people using the type, especially if they are trying to use it in a performant way. If we do decide to keep it in, we definitely need to explain it.
I feel like maybe we should just leave them where they are and mark them as being part of an "expert / could potentially change" interface / maybe add a
--warn-unstablewarning for them. Specifically, I think thatâas part of our multiresolution strategyâthere ought to be some way of dropping into the guts of the GMP type to get at the underlying data (similar to how one might want to poke into the guts of the array implementation and get the C pointer to the buffer(s) implementing their array). So I'd be inclined not to no doc it.
Another approach from Brad (depending on how we handle
mpzStruct, see #17694):