问题描述:

I'm trying to read Clojure source code.

There is a IFn interface whose declaration is like :

public interface IFn extends Callable, Runnable{

I think Callable is generic. How can IFn know what the type specified here?

Interface Callable<V>

网友答案:

It can't. That declaration is basically using the raw type, which is a bad idea. It would be much better to write:

public interface Function<V> extends Callable<V>, Runnable

That said - I hadn't noticed you were talking about Clojure rather than Java. Given that they're building a bridge between languages, they can do what they want with the type system, to some extent :)

相关阅读:
Top