Why doesn't Java have method delegates?

后端 未结 9 1515
再見小時候
再見小時候 2021-02-05 17:42

The Java gurunaths (natha नाथ = sanskrit for deity-master-protector) at Sun should condescend to accept the necessity of delegates and draft it into Java spec.

In C#, I

9条回答
  •  一整个雨季
    2021-02-05 18:14

    Because, they thought that:

    Bound method references [delegates] are simply unnecessary. [...] Moreover, they detract from the simplicity and unity of the Java language. Bound method references are not the right path for future language evolution.

    Taken from this ( old ) white paper:

    http://java.sun.com/docs/white/delegates.html

    Now Java is considering adding them, once the language have evolved enough. I'm pretty sure they will be in the language soon ( at least sooner than Perl 6 :P )

    You can also use: Software Monkey Callback method

提交回复
热议问题