A thought for template alias parameters?

Joel Anderson ask at me.com
Wed Feb 3 22:48:56 PST 2010


On 2/3/2010 10:27 PM, Trip Volpe wrote:
> Joel Anderson Wrote:
>>
>> You could potentially use a mixin to do this.  The resulting code would
>> look something like this.
>>
>> void main()
>> {
>>             int myFoo = 100;
>>             mixin(expectEquals! ( "myFoo == 3" ));
>> }
>
> Yeah, mixins could work, but they're ugly.  ;-)
>
> Forcing the user (in this case the unit test writer) to apply extra boilerplate on their own every time they want to make an assertion is really not much of a solution. There's no semantic reason an assertion should involve a mixin, so allowing that detail to bleed into client code is shaky design.
>
> I know I'd get tired of wrapping everything in mixin(...) all the time, and in the end it would probably result in me writing fewer unit tests.  :-P

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



More information about the Digitalmars-d mailing list