I really don't know much about type inference. I feel like the naive solution 
would be enough for the common cases and manually adding type annotations would 
cover the rest, though. Even if it does compute the wrong result it would error 
out like a normal generic, or do another check for generics after the first 
pass to get a better error message.

It probably would be possible to collect type constraints before anything else 
and solve them without exponential runtime explosions? Anyway, that seems like 
something that could be added at in a later version?.

A naive implementation that goes through all possibilities via backtracking 
probably wouldn't be too bad either as long as there aren't any procs with huge 
numbers of overloads and the implementation throws mismatches out early. In 
that case there probably should be a sanity limit at which the compiler gives 
up, though, or you get stuff like swift's hours of compile time for seemingly 
simple expressions.

Reply via email to