Why not .NET-style delegates rather than closures in Java?

前端 未结 2 795
花落未央
花落未央 2021-02-02 13:39

OK, this is going to be my beating a dying horse for the 3rd time.

However, this question is different from my earlier two about closures/delegates, which asks about pla

2条回答
  •  灰色年华
    2021-02-02 14:23

    C# has closures in addition to delegates. In my mind they are not same.

    delegate = function pointer.

    closure = {function, environment}. Way of defining an [anonymous] function and packaging it with its environment. Strictly speaking latter should only be called closure, the former being 'lambda expression'.

提交回复
热议问题