Overload resolution simplification

Neal Gafter neal at gafter.com
Sun Aug 11 19:11:33 PDT 2013


On Sun, Aug 11, 2013 at 2:23 AM, maurizio cimadamore <
maurizio.cimadamore at oracle.com> wrote:

> On 10-Aug-13 10:52 PM, Remi Forax wrote:
>
>> You mean if you have overloads that are generics ?
>>
> No - in general; as soon as you start type-checking a lambda once per
> overload I think it's unavoidable to end up in a combinatorial scenario for
> lambda such as this:
>
> m(x->g(y->f(...)))
>
> where m, g, f are overloads.


This is true.  However in practice

   1. the compiler can cache the results of the conversion of each lambda
   to each target type that is attempted, which eliminates most of the work,
   and
   2. people do not write code such as this except to stress your compiler.

Cheers,
Neal


More information about the lambda-spec-observers mailing list