A thought for template alias parameters?

Joel Anderson ask at me.com
Fri Feb 5 20:55:00 PST 2010


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);
}

...

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.




More information about the Digitalmars-d mailing list