Idea: Reverse Type Inference
Ola Fosheim Grøstad via Digitalmars-d
digitalmars-d at puremagic.com
Wed May 24 07:28:52 PDT 2017
On Wednesday, 24 May 2017 at 13:03:37 UTC, Steven Schveighoffer
wrote:
> This is different. It's IFTI based on return type.
Well, the way I see it it is a special case of top-down type
inference. Yes, you also have to instantiate the template, but I
assume that happens after type inference is complete?
So my point was more: why not cover the general case, if you are
going to add it as a feature?
> auto p = Point(row.get("x"), row.get("y")); // with better IFTI
Ok, well, I see templates in this context as a variation of
overloading, just with the template parametric type being a set
of types i.e. all types that the program provides, minus the ones
prevented by contraints. I guess it is a matter of vantage point.
It would be odd to allow this for templates only and not provide
it for functions...
More information about the Digitalmars-d
mailing list