I have just been reading some bits about [read: one or two posts] about some of the language features of C# 3.0. One of the new concepts is something called Lambda Expressions, while I am still trying to work out why they might be useful, I can tell you now I don’t like the sytnax at all; It looks nothing like C#; It looks convoluted; It looks NASTY!!!If someone knows better [most probably most of the world :)] then please leave a comment or email me: firstname.lastname@example.orgAbhinaba at Microsoft doesn’t like it too much either, but for more well thought out reasons than I.To Quote:
Why I don’t like lambda expression in C#:C# has originally developed from C++ /Java and is (was :^) ) a strongly typed object-oriented language. The new features being introduced like closure, continuation (yes, yes very limited continuation) in C#2.0 and now type inference, lambda expressions are de-generating the language. Even though there are people go gaga about continuation and lexical closures these are fundamentally functional language features and should be left to that. Introduction of bits and pieces of functional language features are not going to add value to C# and at the same time the surface area of C# is growing beyond what most developer can grasp.I do agree with him a little, as it stands now, at first glance I don’t think I understand the point of it, nor do I want C# to change from an OO language into one that has seemingly convoluted Functional Programming constructs.
Every language has a domain of application and an audience. Most people who work in C# developing web-services and web-based applications today are not necessary computer science grads. For them these concepts are a huge variation from the way C# used to behave. Functional programming is for the academia and not from the industry and should be left as such.
If I am asked, whether I’ll use these language features, my answer will be maybe, and that is because the code written by me will be reviewed and maintained by people in MS who are fairly conversant with these. However, I think these features add burden to the learning curve of people who are not super interested in C# and should be avoided in favor of easier language constructs that might take couple of lines of code more, but would be more readable and maintainable.
These are just my opinions and I’m sure the designers of C# had given a lot of thought before adding them, but I strongly feel that these features are just adding more surface area to the language and will mostly go unused by the masses.
I lead the Chrome Developer Relations team at Google.
We want people to have the best experience possible on the web without having to install a native app or produce content in a walled garden.
Our team tries to make it easier for developers to build on the web by supporting every Chrome release, creating great content to support developers on web.dev, contributing to MDN, helping to improve browser compatibility, and some of the best developer tools like Lighthouse, Workbox, Squoosh to name just a few.