|
|
|
|
|
by louthy
4077 days ago
|
|
Of course you could do many things to make C# closer to F# (I've devoted a whole library to coercing it [1]). My preferred approach would be: var x = ...
? Foo + frob()
: Baz;
Or to be truer to the original (using my lib): var x = ...
? map(frob(), a => Foo + a)
: Baz;
But the idioms of the language mean that in the real world you see the ugly version with the associated risks of uninitialised variables. I applaud the C# team for the direction they're taking. I suspect C# will end up closer to Scala than it will to F#, which isn't a bad niche for it to be.[1] https://github.com/louthy/language-ext |
|