What are the benefits of using Scala in .Net?

2019-04-18 09:44发布

问题:

Scala is a peculiar programming language in that it targets both JVM and the CLR. But what are the benefits? Is it worth considering it as a viable alternative to the F# language?

回答1:

Most of the web search hits I see from "Scala .NET" are from 2008 or early 2009. Scala is an interesting language, but my admittedly-ill-informed impression is that is is not a "viable alternative" for an industrial-strength .NET application.

I see people talk in passing about writing apps that are portable across CLR and JVM, and it's a nice idea in theory, but in practice I don't see any evidence that anyone has done this for reals. (If people do know of examples, please post them.)



回答2:

Scala on .NET is an ongoing effort led by Miguel Garcia. Latest state is that we are almost able to bootstrap on .NET. I have no doubts that something solid will come out of this but it's still too early to make commitments when.

Long term, I do not see Scala as a competitor to F# or C#. It would be hard to compete on an equal footing with languages that are natively suppported by Microsoft. On the other hand, I do see some attraction of Scala for shops that want to run on .NET as well as on the JVM.



回答3:

I really love Scala but in the current state of its .NET implementation: A Big NO. It hasn't been updated in a while. The JVM version is really a lot ahead. I don't see Scala's .NET port maturing enough to match its JVM counterpart in a foreseeable future.

You'd be better off with F#.



回答4:

The benefit for compared to what?

The benefit compared to a different language, that only targets one of the big platforms? Well you can run on both platforms; accessing libraries from both platforms without switching the language;

The benefit of running on .Net instead of JVM? Well if you work in a .Net heavy environment this might be more of an requirement then a benefit.

The benefit compared to F#? I don't know F#, but when you live in a .Net centric world, I'd guess know how for F# will be easier available then for Scala on the CLR. So assuming the two languages are somewhat comparable I'd prefer F#



回答5:

As far as I know, no one really uses Scala.NET yet. If people want to run Scala code on .NET, the best option is IKVM. And Scala works fine on IKVM, from all reports.

There is still work ongoing on Scala.NET, and it looks like it will be viable (with full Visual Studio support) "eventually". This is the most informative resource, Miguel Garcia is currently employed by LAMP and I think funded by a Microsoft grant to improve Scala.NET to production ready status. But this could be misremembered... at least, there is work from August 2010, so its not dead.

Due to stack overflows "clever" spam prevention, I can only post one link. So you will have to google for "IKVM", and "IKVM scala" to find out about those. The link I included is the hardest to find.



标签: .net scala f# clr