Live data from Hacker News

Java 8 lambda syntax decided - same as C# and Scala

mail.openjdk.java.net

21–30 of 81 posts

Re: Java 8 lambda syntax decided - same as C# and Scala

#21
post #14

Earlier quoted context omitted.

Actually for just that example you don't need any of it. new Thread(doStuff).Start();

nah, it would have to be new Thread(new ThreadStart(doStuff)).Start();

Sorry, but since C# 2.0 we could just write "new Thread(DoStruff)" or "SomeDelegate del = SomeMethod".

Re: Java 8 lambda syntax decided - same as C# and Scala

#22

try { // for a really long time } finally { // made a decision }

try { /* for a really long time */ } finally { /* made a decision */ }

Please tell me how you got it formatted like code. I tried a block quote and got italics instead.

Re: Java 8 lambda syntax decided - same as C# and Scala

#23

Earlier quoted context omitted.

try { /* for a really long time */ } finally { /* made a decision */ }

Please tell me how you got it formatted like code. I tried a block quote and got italics instead.

    Indent by four spaces.

Re: Java 8 lambda syntax decided - same as C# and Scala

#25
Nice to see pragmatism playing a role here. A big problem with Java has always been the "design by committee" nature of it where we end up with some theoretical best case that satisfies everyone's egos but turns out to utterly suck when used in practice.

From another point of view ... it's a shame we needed so many years to come up with "let's do it like C#".

Re: Java 8 lambda syntax decided - same as C# and Scala

#30

try { // for a really long time } finally { // made a decision }

There's a JVM language out there that initially allowed try-statements without catch or finally clauses, e.g

    try{
      //for a short time only to decide
    }
But one of its despots, five years after the language was first released, changed the syntax to make a catch or finally clause compulsory, e.g

    try{
      //for a short time to decide
    }finally{}
Because I had used these standalone try-statements a lot, I had to go thru all my code and add empty finally statements to them all.

Scala, on the other hand, still allows standalone try-statements. And Scala and C# also have a better closure syntax than that language, and are more worthy to be copied by Java 8.

Post reply on HN