Open source dmd on Reddit!

Daniel Keep daniel.keep.lists at gmail.com
Sat Mar 7 21:16:10 PST 2009



Ary Borenszweig wrote:
> Charles Hixson escribió:
>> I'm glad that they're there.  And I'm glad that they work.  But I
>> really hate the syntax, and am glad I've never needed to use them. 
>> MUCH better would have been:
>> mixin(bitfields!("
>>      uint, x,    2,
>>      int,  y,    3,
>>      uint, z,    2,
>>      bool, flag, 1
>>      ")
>>
>> even better would have been:
>> mixin(bitfields!("
>>      uint x :  2,
>>      int  y :  3,
>>      uint z :  2,
>>      bool flag : 1
>>      ")
> 
> Why do the parsing yourself if you can leave that to the compiler? Just
> read the docs, pass the arguments and that's it. Way much easier. You
> get standard error messages, if you use an IDE you get autocompletion
> for the parameters, etc.
> 
> I really don't know why everyone is so obsessed with strings... :-P

mixin(cvars!
`
    int window.width as width = 640;
    int window.height as height = 480;
`
);

and

mixin(cvars!
(
    int, "window.width, width", 640,
    int, "window.height, height", 480
)
);

are functionally the same, and have almost exactly the same length.

Except the first looks cooler and has a more natural syntax.  Sometimes,
that's important.

As for the IDE issue, I'm increasingly of the opinion that this is a
shortcoming of IDEs.  For example, I've never seen an IDE that got
script in HTML right.  Certainly not if you change the language being
used under it's feet.

Maybe it's time IDEs started supporting embedded DSLs as a matter of
course.  Dunno how, but that's their problem, not mine.  :P

  -- Daniel


More information about the Digitalmars-d-announce mailing list