Recently on twitter, I asked a question:
I wonder which will happen first: C# gets more awesome F# features, or everyone realises that F# already has the awesome features
c# cannot get some of the fundamental f# features. “Everything is expression” for instance.
This got me thinking, what specific features of F# are impossible, or even unlikely to be the default, in C# in the near future?
Here’s a list I have started:
- Everthing is an expression - expressions are more composable, safer, and compact.
- Immutable by default - C# has a long history with default mutable, it seems changing this would be near impossible.
- Default non-nullablity - C# has a long history with default nulls, as above.
- Type inference - while C# has the
varkeyword, and may get improved type inference capabilities in the future, it seems highly unlikely it could approach the capabilities of F# without a fundamental redesign.
- Conciseness - The F# language is basically designed from the ground-up to be short and concise. From not requiring semicolons and curly brackets, to significant whitespace for code blocks. Common patterns like structrual equality, and type inference contribute to this feature.
More generally, it seems unlikey that C# would do this in the near future:
- Partial function application - Unsure - could this happen?
- Functions that don’t require a class - C# is primarily OO - and the class is the basic building block. It seems like it would require a huge shift in thinking for this to happen. [Update] As a few people pointed out, this feature is either done, or close to being done already
- Computation Expressions - allowing features such as the very flexibile
Have I missed anything here? Have I got something wrong? Let me know.