I need your opinion... (original) (raw)
Florian Weimer fw at deneb.enyo.de
Sun Mar 22 02:40:06 PDT 2009
- Previous message: I need your opinion...
- Next message: I need your opinion...
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
- Marek Kozieł:
What should be the inferred type of an expression with an intersection type? Is there an answer which is acceptable in the COIN context?
That would be type of type's intersection, just like it work now days:
class A {} class B extends A {} public static void main(String[] args) { B some= (true?new A(): new B()); // error cannot cast A to B }
The type of the expression is A.
I was wondering about the case of a method with a type parameter as the return type, and the type parameter has a bound containing an intersection type. This cannot be expressed using Java syntax.
I'm not sure what would happen at the byte code level. It's probably fine to issue repeated casts for each use which doesn't match the erasure (but I seem to recall that interface types are reduced to Object anyway, so this might not be necessary).
The JLS even says that variables can't have type parameters as their types, but there seems to be some mistake.
- Previous message: I need your opinion...
- Next message: I need your opinion...
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]