'This' type

Marek Kozieł develop4lasu at gmail.com
Tue Mar 3 12:40:10 PST 2009


W dniu 3 marca 2009 21:25 użytkownik Neal Gafter <neal at gafter.com> napisał:

> I'd love to see the specification, in particular the subtyping rules
> and modifications to type inference.  Once those are in place, I'd
> like to see an argument that this feature leaves the generic type
> system sound (i.e. there are no ClassCastExceptions unless there are
> casts or warnings in the source code).  As described in
> http://blogs.sun.com/darcy/entry/guidance_measure_language_change_size
> almost any type system change is likely out of scope for project coin.
>
>
>
If we think about it onlt as extension for return types it's quite easy.

interface IA{ This method(); }

interface IB extends IA { }
now:

static void some(IB x){

__ x.method() : return type is IB as This for IB;

__ ((IA)x).method() : return type is visible as IA as This for IA;

}
If u have some doubts, just mail the sample (I do not see any reason for
valid code to make ClassCastExceptions to appear).

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

http://lasu2string.blogspot.com/



More information about the coin-dev mailing list