5 ms·
I tend to think F# is what C# would look like if designed from scratch these days. My take is that C# started out not very good because it copied a not very goo
by mattnewport 8y ago
I tend to think F# is what C# would look like if designed from scratch these days. My take is that C# started out not very good because it copied a not very good language (Java) but they improved on Java a bit and have continued to add things that tend to improve the language within the constraints of remaining backward compatible.
Choosing just on the language I wouldn't choose C# but when working in an ecosystem built around C# (like Unity for me currently) I appreciate many of the features as making things a bit nicer.
- oaiey 8y agoI disagree. First of all, F# is functional and therefore has another design. C# also intentional followed C style languages to pick up developers. C# was built for the masses while functional programming is for the elites (F# is has 10k devs using it, VB.NET has 100k and C# more than a million active users). I agree that there are some syntax they would have designed differently when they would have understand the functional programming influence they have today a bit earlier. When they would design it today from scratch, I think they would look at JavaScript.
- mattnewport 8y agoC# comes from a statically typed language tradition (the dynamic keyword aside) and has very little in common with Javascript beyond the surface level of curly braces. The trend in C# features seems very much influenced by functional programming, adapted to be more familiar and palatable to non functional programmers. Some features of C# that seem influenced by functional programming in general or F# in particular include lambdas, type inference, Enumerable (F# pipelines), pattern matching, tuples, null coalescing (a Maybe if you squint), expression bodied members, record types and Range expressions. There is also what looks like an 'aesthetic' influence of F# in language features that reduce ceremony and make for more concise code like auto properties as well as a functional inspired recommended practice of making immutable types.
- oaiey 8y agoFair assessment and I agree. My comment regards JavaScript was more about to pick up existing developers. C# was always meant for productivity. A rapid learning curve (as opposed to learning functional programming first) is very important here.
- titanix2 8y agoF# wasn't created from scratch at all, it's the last descendant of the ML language family. It was originally developed with some compatibility in mind. So no, a hypothetic today's C# wouldn't look like F# if is wasn't intentionally functional.
- mattnewport 8y agoI didn't say that F# was created from scratch, I'm familiar with its heritage. My point was that C# started as a slightly improved Java but the trend in new language features, particularly in recent years, has shown a strong influence of functional programming in general and F# in particular. Hence the idea that if in some hypothetical universe C# was making changes not constrained by backwards compatibility I would expect it to look more like F# and less like Java.
- pjmlp 8y agoIn that hypotetical universe, without Java history, Microsoft would be focusing on VB and C++, with COM Runtime having replaced COM+.