Re:Deep Dive Into C# 9
by madiathomas on Friday December 06, 2019 @06:09AM
(#21720747)
For that to happen, functional languages have to take over. Most people are just not into functional programming languages. They prefer imperative programming languages. I feel Microsoft is doing a great job of slowly forcing C#.NET Developers to learn F#. It was so easy for me to learn F#. It was so strange that I was able to understand a functional programming language. I didn't have luck learning other functional languages.
F# is intentionally cumbersome for imperative/OOP programming which makes it impractical for many project types.
Not at all. The class definition syntax is very terse and you can use the mutable keyword for imperative programming.
In fact, I think F# is a better imperative language than C#, if you choose to use it that way.
Re:Deep Dive Into C# 9
by StreamBright on Friday December 06, 2019 @07:32AM
(#21721200)
Yep this is my experience as well. isNull make it easy to pattern match on null, the only thing I really needed to have a terse way of dealing with outside word, either C# modules or IO that can have nulls. I was shocked how smooth everything is. I was productive maybe in 2 days without prior knowledge of the entire MS/.NET/C# world. The reason why I chose F# was because of the similarity to OCaml's syntax.
Re:Deep Dive Into C# 9
by StreamBright on Friday December 06, 2019 @05:04AM
(#21720464)
Can you back this up with some examples ? I feel it is exactly the opposite. For loops, mutable dictionary, in place updates to name a few imperative things you can do with easy in F#
But the .Net framework is mostly implemented C# / classes, so your F# code will always need to reference those objects from the stack which may be null etc. This is why I think MS is still building C# becuase a rewrite of .NET to pure f# is not worth it. My 2c.
Re:Deep Dive Into C# 9
by tigershark on Friday December 06, 2019 @05:48AM
(#21720650)
The only cumbersome part is when you need to interop with C#. The .net event syntax is ridiculous for example.
The imperative features feel bolted on and underdeveloped. Just try to break out of a loop or do an early return in f#. The language really discourages the pure interface, impure implementation approach. I feel often compelled to use explicit tail recursion instead, which in turn feels like it's placed in a weird middle ground between a goto fest and structured programming.
If you allow early returns in a loop then loops are no longer expressions.
F# should be Microsofts main language, not C# It's a great language that doesn't get enough attention IMO.