Compile-time exceptions

Christopher Wright dhasenan at gmail.com
Tue Nov 25 04:08:26 PST 2008


bearophile wrote:
> On the topic of idioms: I may also use an idiom just shown to me by downs, to allow "passing" "function templates" to other functions:
> _sum { T opCall(T)(T[] array) { ... } } _sum sum;

I don't know what this is doing. That code fragment won't compile, and 
it isn't showing usage.

Passing an instantiation of a function template is easy -- you just pass 
in a function. Passing a template requires an alias template parameter, 
I think.

Virtual templates would allow you to use polymorphism in this case, but 
that's not going to be considered for quite some time, if at all.

> That's another situation where I think some built-in syntactic sugar can be useful. Do you have ideas regarding a possible syntax/statement?
> 
> Bye,
> bearophile



More information about the Digitalmars-d mailing list