Implicit enum conversions are a stupid PITA

Nick Sabalausky a at a.a
Thu Mar 25 19:38:02 PDT 2010


"Andrei Alexandrescu" <SeeWebsiteForEmail at erdani.org> wrote in message 
news:4BABC1F7.6080504 at erdani.org...
> On 03/25/2010 02:52 PM, Nick Sabalausky wrote:
>>
>> I can agree mixins are a perfectly fine interim solution for anything not
>> already in the language, and for truly obscure needs (I use them all the
>> time for both situations myself). But I'd still hardly consider flags and
>> bitfields (to be clear, I'm talking about the abstract concept of a 
>> bitfield
>> in general, not necessarily the C-style
>> struct-with-sub-byte-member-alignment bitfield syntax/semantics) to be an
>> "obscure" need in something that's supposed to be a systems language. I
>> guess we just have a fundamental disagreement on that.
>
> In what ways do you find the bitfield interface wanting?
>

Ignoring frequency-of-usage for the moment, since this is a question of 
syntax, compare these two syntaxes of creating a struct:

mixin(struct!("myStruct"
    uint, "x",
    int, "y",
    uint, "z",
    bool, "flag"));

Versus the current:

struct myStruct {
    uint x;
    int y;
    uint z;
    bool flag;
}

There's just less syntactical noise, and the syntax is designed around the 
semantics rather than shoehorning various generic syntaxes to fit the 
purpose.





More information about the Digitalmars-d mailing list