Re:Java 8 lambda syntax decided - same as C# and Scala
by onedognight on Thursday September 08, 2011 @09:02PM
(#2976344)
According to the grammar int the OP, you need ()'s, no?
Or can they be elided in C# or Scala?
[ Parent
| on HN ]
Re:Java 8 lambda syntax decided - same as C# and Scala
by swax on Thursday September 08, 2011 @09:20PM
(#2976376)
Actually for just that example you don't need any of it.
new Thread(doStuff).Start();
Re:Java 8 lambda syntax decided - same as C# and Scala
by MatthewPhillips on Thursday September 08, 2011 @09:23PM
(#2976383)
nah, it would have to be new Thread(new ThreadStart(doStuff)).Start();
Re:Java 8 lambda syntax decided - same as C# and Scala
by jeffz on Thursday September 08, 2011 @09:56PM
(#2976456)
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
by politician on Thursday September 08, 2011 @11:32PM
(#2976660)
I can't resist, so,
public static class ActionExtensions
{
public static void InvokeAsync(this Action<object> target, object context)
{
new Thread(obj => target(obj)).Start(context);
}
}
((Action<object>) (Console.WriteLine)).InvokeAsync("Hello, World");