[Issue 15364] BitArray.len should be private

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Nov 1 17:59:01 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=15364

tmarplatt at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tmarplatt at gmail.com

--- Comment #7 from tmarplatt at gmail.com ---
The following commit related to this issue

https://github.com/dlang/phobos/commit/74fbb79087c46ebde38ac3648b6a46b76f2a0a9e

has apparently overreached when setting bitsPerSizeT as private state.

The intended fix is successful in hiding .len and .ptr, but there is no
explicit rationale (in this thread and in the commit message) for also
encapsulating .bitsPerSizeT.

Namely, the question is: why has BitArray.bitsPerSizeT been made a private
member? It's an enum. It can't be accidentally nor intentionally rewritten.

I've ran into "variable std.bitmanip.BitArray.bitsPerSizeT is not accessible
from module" errors because my module imports from an (albeit old) library
which implements certain bit setting algorithm that relies on
BitArray.bitsPerSizeT being publicly accessible.

(If you need to know, the library in question is artemisd:)
https://github.com/elvisxzhou/artemisd

After examining the problem, the commit and the issue that produced the
problem, I believe that the mentioned commit introduces an unintended
regression, and that it deserves to be reviewed.

--


More information about the Digitalmars-d-bugs mailing list