Sugar around string mixins (was: Why not move cast to the standard library?)

Jarrett Billingsley jarrett.billingsley at gmail.com
Sat Oct 3 18:33:37 PDT 2009


On Sat, Oct 3, 2009 at 9:22 PM, Sergey Gromov <snake.scaly at gmail.com> wrote:

> While I like and support the idea, I think that hijacking the "macro"
> keyword now will make it very hard to re-design later.  It would be much
> better to reuse the "mixin" keyword for this since it's exactly what's
> happening: defining a function for mixing in:
>
> mixin max(int a, int b) {...}
>
> It could be problematic from the grammar perspective though.

Newp. 'mixin' could be followed by one of four things:

- '(', it's a string mixin.
- 'ident' '!', it's a template mixin.
- 'ident' ';' it's also a template mixin.
- 'ident' '(', it's a mixin declaration.

Not tough. But then you're really overloading the keyword by using it
for three very different purposes.



More information about the Digitalmars-d mailing list