by MichaelGG · 11y ago · 0 comments
But without making things expressions, it's still gonna be clunky. First class immutability and expressions instead of statements would help propel it further. I still would feel rather limited about having no type inference on local functions, though.
What would be really exciting is if the runtime was also open for some real changes. Traits, non null, slices, maybe even ownership (so we could stack alloc, a huge perf win)... One can dream.
http://fsharpforfunandprofit.com/posts/is-your-language-unre...
Then use C. In OOP comparing objects of different types is key to inheritance. The reason their example works is because everything in C# inherits from object, so you'll always find some commonality to compare.
You could have the compiler generate a warning when object.equals is used (rather than overridden) but getting rid of comparisons between different object types completely is backwards and will reduce efficiency.
It's possible to write shitty code in every programming language. Of course, the specific methods of doing so differ, but I've yet to see a Turing-complete language that makes it impossible to write buggy code.
So yes, shipping F# with VS is a good step, and technically it's supported, it's obvious MS has some discomfort there. Which is too bad, cause F# is a rare jewel, nothing else has the combination of language features, interop/library, performance, and tooling.
Hopefully with F# in open source hands now this can continue to improve. In the meantime, I'm studying up on C# and .NET, so that I hopefully have at least the bare minimum familiarity to work around these limitations.
Even now, doing MVC websites is far more difficult out of the box if I code F#. MS still lacks JS backends, so we need third party compilers for that model... Maybe because they don't want to upset or look less than 1000% behind typescript.
I will say though otherwise I'm happy. In using F# to run my server apps with smooth pinvoke into my Rust code, which is expressive enough to offload a lot of logic. And with VS soon to be free, and Mono working fine, MS might not get any money from it. (Why deploy any sort of scale on Windows when it's line $35/core/month?) So, in that sense it's selfless and I'm quite grateful.
You will never sell the typical VB.NET/C# enterprise .NET developer into F#.
I find very commendable what Microsot has done so far, even if it feels too little.
It rises the visibility of the language, specially to managers and drives CLR design decisions that help FP implementations, like TCO.
Let me know when Oracle gives at very least the same level of support to Scala in Netbeans and JVM design.
MS doesn't need to sell the typical enterprise dev. They just need to not sour-coat things and be honest and complete in their statements. It'd also be nice if MS viewed shipping actual language independent code, instead of stuff that takes dependencies on C# compiler details.
MS gained a huge amount from the F# folks by getting CLR generics from them - that's one major benefit over the JVM. Just on that alone perhaps they owe them that (maybe, I've little clue of internal politics, except that there is some resentment towards F#, and at least a bit of censorship on publishing things that make C# look poor).
Let me know when Microsoft starts shipping Rust-level features, so we can deal with memory safely and reduce bugs without losing perf.
The real power of Tuples only comes with deconstruction and matching, such as "var (a,b) = GetSomething()" and "case (_, y)".
So these features would go hand in hand. Deconstruction and matching requires lang level tuples, and lang level tuples are pretty lame without deconstruction and pattern matching.
See http://en.wikipedia.org/wiki/Nominal_type_system and http://en.wikipedia.org/wiki/Structural_type_system.
So while I can write
var x = { FirstName = "Riff", LastName = "Raff" }
and then go ahead and access x.FirstName and x.LastName, I can't declare a method signature like this: void Display({ string FirstName, string LastName } nameRecord)
{
}
This is the kind of thing which is being proposed (along with possible pattern matching/decomposition syntax which is new ground for C#)