third draft: add bitfields to D

Walter Bright newshound2 at digitalmars.com
Wed Jul 17 03:24:28 UTC 2024


On 7/4/2024 11:34 AM, Steven Schveighoffer wrote:
> Walter, is this possible to do?
D originally had the "bit" data type, which represented a single bit. It was a 
great idea.

But I ran into endless problems with it.

It turned the type system on it's ear. You couldn't take a pointer/reference to 
it. It problems being the subject of a type constructor. For example, what does 
it mean to have one bit be const and the adjacent bit be mutable?

I spent so much time trying to work it in that the benefits of it became swamped 
by the complexity. (Sort of like how "volatile" infects everything in C++, way 
beyond the scope of what volatile actually is.)

So I gave up and removed it all. Haven't missed it :-/


More information about the dip.development mailing list