5 ms·
Thanks for responding. I think that makes sense. I’m definitely thinking of it from a language semantics perspective and this is a case where type erasure feels
by dullcrisp 20d ago
Thanks for responding. I think that makes sense. I’m definitely thinking of it from a language semantics perspective and this is a case where type erasure feels particularly counterintuitive to me.
Would including the specialized method in the derived interface bytecode preemptively take us all the way to C++ templates and ruin everything that’s good about Java? Or is it a matter of type erasure being consistently applied and if it were ignored selectively it would make everything more confusing?
Like if we had final class Foo implements Func<…> then we’d presumably need to supply a typed implementation of apply, so the fact that we can get away with the generic one in a specialized interface feels surprising, even though I can see why it’s technically correct.