More Typing Problems

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Tue Sep 7 07:42:39 PDT 2010


On 07/09/10 14:55, Florian Weimer wrote:
> * Maurizio Cimadamore:
>
>    
>> with an actual argument of the kind:
>>
>> #(c){c.getName()}
>>
>>
>> So, given that there's no explicit type on 'c' and given that the method
>> 'select' is accepting *any* subtype of SAM<T,U>  for any U, I'm having
>> hard times in imagining an inference scheme that can infer something
>> meaningful (not Object) for 'c'.
>>      
> This particular case isn't really a problem.  OCaml infers its type as
>
>    <  getName : 'a; ..>  ->  'a
>
> meaning "a function from an object which has got a getName method (and
> possibly other methods) returning a value of type 'a to a value of
> type 'a".  There are probably some issues if you treat SAM conversion
> as a variant of ML type ascription, but those can probably be solved.
>    
Smells of structural subtyping ;-) ?

Maurizio
> I don't think this would solve the chained calls issue, though,
> because select(#(c){c.getName()}) would still not be polymorphic.
>
>    



More information about the lambda-dev mailing list