PROPOSAL: 'final' without explicit type

Marek Kozieł develop4lasu at gmail.com
Thu Apr 2 12:48:30 PDT 2009


2009/4/1 Florian Weimer <fw at deneb.enyo.de>:
> * Marek Kozieł:
>
>>       <T extends I1&I2,K extends I1&I2> void noInterection(T t,K k){
>>               if (boo)t=k; // Type mismatch: cannot convert from K to T
>>               ...
>>       }
>
> The assignment is not type-safe anyway, as the following modification
> shows:
>
>
>        <T extends I1&I2,K extends I1&I2> T noInterection(T t,K k){
>                if (boo)t=k; // Type mismatch: cannot convert from K to T
>                return t;
>        }
>
> This would allow to convert values of any type which implements I1 and
> I2 to any other type which implements the two interfaces, which is
> clearly bogus.
>
> Consequently, I think your snippet doesn't show what you claim.
>

I wanted to show when assignment is possible :

Intersection : I1 & I2
Bounds : $ extends I1 & I2

Intersection = Bounds // OK
Intersection = Intersection // OK
Bounds = Intersection // Error
Bounds = Bounds // Error

-- 
Pozdrowionka. / Regards.
Lasu aka Marek Kozieł

http://lasu2string.blogspot.com/



More information about the coin-dev mailing list