New syntax proposal for template type parameter contraints

Kagamin via Digitalmars-d digitalmars-d at puremagic.com
Wed May 21 23:26:27 PDT 2014


On Friday, 16 May 2014 at 23:14:13 UTC, Idan Arye wrote:
> Another problem is that we now have to have an argument if we 
> want to pass a template parameter, which is a serious 
> limitation.

I'd say, it's not different from selection from an overload set.

On Saturday, 17 May 2014 at 01:28:50 UTC, Idan Arye wrote:
> When I see such a signature as `void myTemplateFunction( 
> InputRange!int r ) {` I'm automatically assuming I can do 
> things like `void function(InputRange!int) foo = 
> &myTemplateFunction;`, but in our case I can't since it's a 
> template.

One of possible applications of this feature would be 
specification of constraints for variable types to improve 
readability:

range!int r = ...

So it should work like a normal type.


More information about the Digitalmars-d mailing list