third draft: add bitfields to D
Dave P.
dave287091 at gmail.com
Sun Jul 21 00:22:15 UTC 2024
On Wednesday, 17 July 2024 at 03:24:28 UTC, Walter Bright wrote:
> 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 :-/
This is a misunderstanding of my post. I didn’t intend to
introduce a new type, just that the syntax changes. D prefers
modifiers of types to be one the left hand side instead of C’s
weird postfix array notation. So D bitfields would similarly be
next to the type instead of after the field name.
More information about the dip.development
mailing list