This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Re: F# vs. Scala

No replies
kolotyluk
Joined: 2010-06-04,
User offline. Last seen 5 weeks 15 hours ago.
Thanks, that helps a lot.

At the moment I would rather not tie myself into a Microsoft solution, so I tend to prefer Scala as being a little more o/s agnostic. On the other hand I imagine you could also use F# with Mono. A year ago I was interested in Scala on .NET, but there did not seem to be much use of it at the time. Also, at that time one of our developers was really keen on F#, while I was the Scala keener in the group, but we were both advocating increased use of functional programming. Also at that time I was trying to make the case that Scala could be used in both our Java and .NET environments, so out team would only have to learn one new functional programming language instead of two. When I recently saw F# climbing in popularity, I was curious as to why, and how F# was different.

Cheers, Eric

On 2011-09-17 9:23 AM, James Black wrote:
8hnOOsBp3ZO2fxow+4Qvw [at] mail [dot] gmail [dot] com" type="cite">The fact that F# is part of VS2010 helps to get more users.
They are both hybrid functional/object-oriented languages, but whereas Scala seems to be a new language, F# started off largely as a .NET version of OCaml, with some differences (http://stackoverflow.com/questions/179492/f-and-ocaml).  
This question is 3 years old, but is at least a good starting point, to answer your question. http://stackoverflow.com/questions/168428/f-and-scala-comparison
Both of them achieve the goal of trying to bring functional programming more to the forefront, to help developers to better solve some problems.
I think trying to compare them, or look at the differences is the wrong approach, that leads to an us-them way of thinking.
Both are tools, look at what you are trying to do, and determine the best tool to help solve the problem.  For example, if you want to do all your development in Visual Studio, then F#/C# blending may make more sense, but if you feel comfortable with using different languages and IDEs then you can use C#/Scala.
If you need parser combinators then Scala has them as part of the design, whereas F# has a way to do this by using something external (http://www.quanttec.com/fparsec/).
In my experience the main difference for me was the fact that F# requires that you use something after it was defined, and this can lead to problems when you have circular references, whereas the class-based approach of Scala allows you to define a function anywhere, as long as it is in scope, and it is useable.  
The implicits in Scala are also very useful, but in F# I haven't seen this (http://stackoverflow.com/questions/1686895/is-there-an-equivalent-to-creating-a-c-implicit-operator-in-f). 
On Sat, Sep 17, 2011 at 12:07 PM, Eric Kolotyluk <eric [dot] kolotyluk [at] gmail [dot] com" rel="nofollow">eric [dot] kolotyluk [at] gmail [dot] com> wrote:
Not to imply the title means there is any competition between F# and Scala, but out of curiosity, could some of the more knowledgeable people be able to contrast the two languages. I have not studied F# very much, so I was wondering what major features distinguish the two languages.

Just as C# was Microsoft's response to Java, is F# Microsoft's response to Scala?

Looking recently at the Tiobe Index, F# is rated 23 while Scala is rated 50 - just over twice as many users of F# as Scala (0.512%/0.209%). Do people think that is because F# is bundled in with the Visual Studio release while Scala is not bundled in with either Java or Eclipse, or is there some other reason? Would it help if Scala simply became part of the Eclipse release, sort of the way Maven and other technologies have?

Cheers, Eric



--
"I know that you believe you understand what you think I said, but I'm not sure you realize that what you heard is not what I meant."
- Robert McCloskey

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland