It's nice that F# has better type inference, but I feel like it really isn't that different than C#. If C# got rid of boilerplate, made brackets optional, and fixed type inference, what does F# buy you?
It's nice that F# has better type inference, but I feel like it really isn't that different than C#. If C# got rid of boilerplate, made brackets optional, and fixed type inference, what does F# buy you?
I make the inverse argument: At a minimum, you can use F# as C# but with better syntax. So what does C# buy you, if you're not using some of the VS designers?
I don't really see a need for workflows, I can do everything I need to use workflows for with custom LINQ.
I'll reconsider pushing F# for some of the c# work I do. However, if someone isn't bound to the CLR, i'll ask what F# gives you over Scala :-)
Versus Scala, F# seems far more concise. Scala seems to be very Java/OO oriented, and comparatively verbose. I understand the type system is more advanced in Scala. But I've not written anything in Scala so this is sorta speculation. I'd be surprised to find that the tooling for Scala surpasses F#'s though.
And yes, the CLR is a bit of a second-class citizen.
1. In scala you could write
class MyClass[A[_]](a: A)
and it can only take a 'container' (List/Future/Option).in C#/F# this is invalid:
class MyClass<A<?>> {
public MyClass(A a) {
}
}
You could make a plain ol' generic that took a concrete type List<Int> but not just on the type.2. Implicit Conversion: In C#/F# you get extension methods, but it doesn't help you take an existing class and ad-hoc make it implement an interface.
So in scala I could do this:
trait XMLSerializable {
def toXML(): XMLNode
}
and then let's say I want to make existing classes in the standard library implement this interface: implicit def toXMLSerializable(li: List[_]): XMLSerializable =
new XMLSerializable {
def toXML = {
transformListToXML(li)
}
}
I can now do: val genericXmlSerializable: XMLSerializable = List[Int](1,2,3,4)