Live data from Hacker News

New in C# 10: Easier Lambda Expressions

dontcodetired.com

1–10 of 111 posts

Re: New in C# 10: Easier Lambda Expressions

#6
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

The markdown parser of the "Reddit Sync" app adds closing tags to things as well. Hasn't been annoying enough for me to switch.

Re: New in C# 10: Easier Lambda Expressions

#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 occurrence to really need type inference or the ability to add types to lambda expressions.

Heck, I'd say, by now with local functions most lambdas that previously would have been a local could now just be a local function.

Re: New in C# 10: Easier Lambda Expressions

#10

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: mostly OOP/imperative, mostly mutable, statement-based, statically typed but with a less expressive type system (no sum types, exceptions and nulls over Result and Option) and very limited local type inference.

The F# style is enabled by a set of features - some of which would be really hard to add to C# (such as currying and global type inference) - but even if they were added, the millions(?) of C# developers would be unlikely adopt the functional style just because it was possible. A language is not just a list of features; each language has its own culture and "idiomatic" way of doing things.

Post reply on HN