Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Code generation is definitely important to talk about, but that really wasn't the focus of my first example. Even if Foo and Bar were both reference types, the same reasoning would apply.

In C#, you can do:

    class MyClass : IList<Foo>, IList<Bar> { ... }
In Java, you can't do:

    class MyClass implements List<Foo>, List<Bar> { ... }
I know this is commonly viewed as an annoying restriction, but, IMO, it's rather an indication that you're writing code that doesn't respect the contract of the generic interface. For example, what should the `Count` property return if you're implementing IList<T> twice? (C# wiggles around this with explicit interface implementations, but I think it's fair to argue that that's not a strictly superior approach to Java's).


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: