Live data from Hacker News

New in C# 10: Easier Lambda Expressions

dontcodetired.com

11–20 of 111 posts

Re: New in C# 10: Easier Lambda Expressions

#11
post #5
post #3

There's something clearly wrong with the code samples: look at the "closing tags" which somehow sneaked in in line 17 of the first sample

Yeah, I tried those out in a scratch pad. They don't compile.

Seems the renderer has "helpfully" added closing tags for the `` generic parameter lists since they look like *ml...

Re: New in C# 10: Easier Lambda Expressions

#12
With this the language gets a little more beautiful. On a related note, I just switched from a C# job at Microsoft (microservices) and moved to a Java shop where we're all really just starting to learn Kotlin and migrate our work there. I'm shocked how many times we've learned a fancy feature and I get to say, "actually, C# has something just like this too." (i.e. operator overloading) It is a surprisingly modern language keeping up with the other ones.

Re: New in C# 10: Easier Lambda Expressions

#14
post #12

With this the language gets a little more beautiful. On a related note, I just switched from a C# job at Microsoft (microservices) and moved to a Java shop where we're all really just starting to learn Kotlin and migrate our work there. I'm shocked how many times we've learned a fancy feature and I get to say, "actually, C# has something just like this too." (i.e. operator overloading) It is a surprisingly modern lan…

Err.. I'm too drunk to check, bit I'm fairly sure C# has had operator overloading for like ten years?

Having worked recently in it, I found Java to be relatively (as a language, not for tooling) backwards compared to C#.

Re: New in C# 10: Easier Lambda Expressions

#15
post #12

With this the language gets a little more beautiful. On a related note, I just switched from a C# job at Microsoft (microservices) and moved to a Java shop where we're all really just starting to learn Kotlin and migrate our work there. I'm shocked how many times we've learned a fancy feature and I get to say, "actually, C# has something just like this too." (i.e. operator overloading) It is a surprisingly modern lan…

Err.. I'm too drunk to check, bit I'm fairly sure C# has had operator overloading for like ten years? Having worked recently in it, I found Java to be relatively (as a language, not for tooling) backwards compared to C#.

C++ had operator overloading in the 90s. Mostly we decided it was a bad idea.

Every generation must learn this for themselves though.

Re: New in C# 10: Easier Lambda Expressions

#16

F# is really, really bleeding into C#. There'll be a convergence, for all intents and purposes, by about C# 15 at this rate.

Ehhh, not really. It really depends on what you mean by convergence. You could add every single one of F#'s features into C#, and I still wouldn't consider them to be same language or the other to be irrelevant. The strength of F# is the primary coding style: mostly functional, mostly immutable, expression-based, strongly typed with global type inference. The way most C# is written is almost the polar opposite: mostl…

Look at JavaScript though. A few years back it was all about loose typing, mutation, OOP (with prototype), etc and now TypeScript is king, React and Rx are promoting functional idioms (immutability, purity). So I think that can teach us that when a language can be typed and functional there could be a vibrant community that uses it that way while there’s another that doesn’t

Re: New in C# 10: Easier Lambda Expressions

#17
post #7

Nice, I like it. I do wonder what was limiting them before

Every feature starts out with -100 points. So there's always a trade-off to do everything you can imagine to make every last corner case nice or shipping something in a reasonable timeframe. When lambda expressions were introduced they were designed to work well together with LINQ and that whole part of the language isn't a small one either. Storing a lambda expression in a local variable is not such a common occurre…

Yeah, while I run into the sharp edges that this feature addresses on a regular basis, it typically only costs me a small amount of typing to fix, and it's not that frequent. So it's nice to have but totally reasonable that they never got around to it before.

Re: New in C# 10: Easier Lambda Expressions

#18
post #12

With this the language gets a little more beautiful. On a related note, I just switched from a C# job at Microsoft (microservices) and moved to a Java shop where we're all really just starting to learn Kotlin and migrate our work there. I'm shocked how many times we've learned a fancy feature and I get to say, "actually, C# has something just like this too." (i.e. operator overloading) It is a surprisingly modern lan…

You’re going to love Kotlin, it really is a fantastic pragmatic language.

You’re also likely to discover that while C# the language is amazing, the CLR runtime looks frankly minor league when compared to the JVM.

Re: New in C# 10: Easier Lambda Expressions

#19

Earlier quoted context omitted.

Err.. I'm too drunk to check, bit I'm fairly sure C# has had operator overloading for like ten years? Having worked recently in it, I found Java to be relatively (as a language, not for tooling) backwards compared to C#.

C++ had operator overloading in the 90s. Mostly we decided it was a bad idea. Every generation must learn this for themselves though.

Except C++ didn't learn that operator overloading is bad. C++ learned that operator overloading for everything was bad.

The language kind of put itself into a corner when what C# calls `MoveNext` is called `++` (with two variants of course) and what C# calls `Current` is called `*`. Taking what mathematically worked for iterating an array and taking it piecemeal to define your syntax is the kind of operator overloading that is a bad idea.

Re: New in C# 10: Easier Lambda Expressions

#20

Earlier quoted context omitted.

Err.. I'm too drunk to check, bit I'm fairly sure C# has had operator overloading for like ten years? Having worked recently in it, I found Java to be relatively (as a language, not for tooling) backwards compared to C#.

C++ had operator overloading in the 90s. Mostly we decided it was a bad idea. Every generation must learn this for themselves though.

I thought we just decided C++ was a bad idea? :) (shhh, nobody tell the games guys)
Post reply on HN