On Wed, Aug 19, 2009 at 1:03 AM, Peter Becker <peter.becker...@gmail.com>wrote:
> > Interestingly Java's generics allow the dual construction on interfaces: > > public <T extends Interface1 & Interface2> void someMethod(T param) {...} Yeah, you can do intersection types in generics. But you can't write Interface1 & Interface2 foo() {...} Interface1 & Interface2 x = foo(); Also, note the syntax is different when you create a new type in that intersection class Bar implements Interface1, Interface2 Java is maddening with its irregularity. > I really like the idea of having the anonymous unions/joins and > considering that the resulting type system should be a complete lattice > they sound manageable to me -- both for the compiler and the human > reader. Does anyone know reasons why no language seems to have this > feature? > > I honestly don't know. I'm not aware of any languages with that kind of union type. Certainly with Scala's pattern matching it would be a prime candidate for re-extracting union types, but even it doesn't have them. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to javaposse@googlegroups.com To unsubscribe from this group, send email to javaposse+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/javaposse?hl=en -~----------~----~----~----~------~----~------~--~---