implicit template constraint notation

bearophile bearophileHUGS at lycos.com
Mon Jun 10 15:04:00 PDT 2013


Timothee Cour:

> ah, great! So I guess it must indeed be a good idea!

I don't know. It's a cute idea, but I think it doesn't add a lot 
of value. What are its advantages in D beside reducing a little 
the amount of code?


> In what I suggest, the restriction is much weaker so it'd be 
> more generally
> applicable: for example, 'auto myfunction ( isSomeString a, 
> isInputRange
> b)' would work in what I suggest but not with the proposal in 
> the link. I
> don't think it adds any confusion.

"myfunction(isSomeString a, isInputRange b)" should work.

The restriction was different, about code like:
myfunction2(isInputRange a, isInputRange b)

And then trying to instantiate myfunction2 with two types (for a 
and b) that are both input ranges but are two different types.


> Should I draft a DIP?

Feel free, but be prepared to not see lot of people interested in 
it.


> I'd like to get more feedback before though.

Right. Andrei is expert on this topic.


> just filed: http://d.puremagic.com/issues/show_bug.cgi?id=10325

I have added a note. It's good to help as much as possible the 
person that will write the patch :-)

Bye,
bearophile


More information about the Digitalmars-d mailing list