On 2/5/2010 8:55 PM, Joel Anderson wrote:
On 2/4/2010 4:41 PM, Trip Volpe wrote:
Joel Anderson Wrote:
That's one of the reasons I've wished D had a nicer syntax for the
string mixin format. This one kinda scares people away :p
What kind of syntax do you have in mind?
Making mixins less obtrusive might ease aggravation when they're being
used as boilerplate, but making it harder to see when they're being
used might have downsides as well. :-P
Not sure. I'm sure there's a syntax that could meet both goals.
Something like.
void expectsEquals(string data)()
{
mixin(data);
}
I mean:
void expectsEquals(string data)()
{
mixin(dostuff(data));
}
...
expectsEquals!("myFoo == 3")();
or
expectsEquals!("myFoo == 3");
For a case like this, though, I still think the best solution would be
to allow for template parameters that can alias whole expressions.
Together with the other compile-time reflection abilities of D, I
think it would make quite a powerful tool.