Proposal: static template(fail)

BCS ao at pathlink.com
Fri Dec 14 12:01:17 PST 2007


Reply to Bruce,

> On Fri, 14 Dec 2007 19:09:25 -0000, BCS <ao at pathlink.com> wrote:
> 
>> what would this do?:
>> 
>> template Foo(T)
>> {
>> static if(logic1!(T)) template(fail);
>> }
>> template Foo(T)
>> {
>> static if(logic2!(T)) template(fail);
>> }
>> from a programers level, it might be valid. My though is (an wow
>> could  this be costly) try all cases*, if there isn't exactly one
>> match, error.
>> 
>> * Walter's not going to like that for performance reasons.
>> 
> I'm not so sure about that. Its a bit like saying he wouldn't like you
> to
> write poorly designed / optimised code. He may not like it but a
> programming
> language can't help but permit it even if it does discourage it.

I'm taking about DMD's performance. The compile time cost of find a template 
match could go through the roof with the "backtracking finds one match" solution.





More information about the Digitalmars-d mailing list