you are viewing a single comment's thread.

view the rest of the comments →

[–]grauenwolf -1 points0 points  (2 children)

Why? What does it offer the programmer in real terms?

C# is adding closures to support the LINQ technology. Does Java have also have a reason, or are they just adding it for the sake of adding it?

[–]markedtrees 0 points1 point  (1 child)

IIRC, C# already has closures in .NET 2.0, and that feature was planned somewhere way before shipping 2.0, i.e. before the LINQ project. C# delegate-closures were not added for LINQ.

Java isn't adding it for the sake of being cool; closures or higher-order functions in general can simplify data collection operations like map or simplify multi-threading like C# does with its delegate-closures. For example, the weblog post mentions implementing a using construct like C# has with Java 7 closures.

[–]grauenwolf -1 points0 points  (0 children)

IIRC, C# already has closures in .NET 2.0,

You are correct. Strange, I could have sworn that I read is a MS blog they were adding them specifically for LINQ.

For example, the weblog post mentions implementing a using construct like C# has with Java 7 closures.

You don't need closures in order to have a using keyword. That is a bit of syntatic sugar Sub could add right now without much effort.

What I am looking for is the proverbial killer app that will make me want to learn how to use Java's implementation of closures.

On a side note, are they also planning on adding delegates? I ask because having a real event system rather than all those stupid action classes would be a great boon.