2 ms·
Why F#? Well, it's a great strategy for Microsoft to keep a language that certain geeks want to code in. I've been on .NET since before the first Beta, and I wo
by MichaelGG 16y ago
Why F#? Well, it's a great strategy for Microsoft to keep a language that certain geeks want to code in. I've been on .NET since before the first Beta, and I would not stay on .NET for many projects if it weren't for F#. Writing in C# is just too painful. F# makes developing for .NET a pleasure.
C# is not even close to F#, feature wise. C# and VB have taken the path of picking the "sweet spot" of features, and adding special compiler magic to implement those exact things. So, on some comparisons, C# looks just great. But actually going off the blessed path means a lot of pain. Here's a quick list of why F# is nicer:
- Vastly more lightweight syntax
- Far more advanced type inference
- Sequence expressions (and list/array comprehensions)
- Modules
- Hierarchical code (nest modules in modules, functions in functions)
- Interactive mode (FSI)
- Custom dynamic support (it provides an operator, you provide the implementation)
- Inlining support (handy for type tricks and great for performance)
- Recursion support (either tailcalls, or the compiler rewrites your functions to loops)
- Object expressions (create an object implementing an interface on the fly)
- Workflows (especially for async code)
- Full quoted code (C#'s Expression<T> is pretty weak - again, it was just made to enable certain translation to SQL scenarios)
That's just off the top of my head.
Oh, and it still has nearly all of C# imperative/OO features. I can pass addresses, allocate off the stack, use pointers, and so on. On the OO side it has everything except the ability to create new "protected" visibility members.
Basically, even if you know nothing about functional, and just code in an imperative and OO style, F# is better.
- equark 16y agoType Providers in the next version of F# should be another impressive feature. This will really change the way F# interoperates with data and Web APIs. Type providers make everything available, strongly typed, from intellisense with no visible glue code. http://bit.ly/bfWDkA http://bit.ly/bfWDkA