News for hackers. Stuff that matters.
Re:Span<T> in C# by Pxtl on Sunday November 19, 2017 @08:14AM (#15733768)
While anonymous inner classes are more verbose, they're also more powerful because you can create a whole class instead of a single method.
Re:Span<T> in C# by noblethrasher on Sunday November 19, 2017 @08:52AM (#15733874)
But, they're equivalently powerful with respect to an API.

In Java, a method might expect one instance of a class, to which you can pass an instance of anonymous class, whereas in C# a method might expect a set of delegates, to which you can pass a set of anonymous delegates or lambda expressions.

However, thanks to C#'s type inference, it actually ends up being far less verbose, yet more flexible, because anonymous delegates and lambdas can close over local variables. So, strictly speaking, they're more powerful than anonymous inner classes.

On the other hand, as someone that greatly admires Smalltalk, I sometimes envy Java's slightly better purity.

Re:Span<T> in C# by pjmlp on Sunday November 19, 2017 @09:17AM (#15733970)
During Java early days, I was a big fan of Eclipse's Java browsing perspective, it was a way to feel like I was still using Smalltalk.