43

Scala seems to have a .NET implementation too. I was wondering if it's a complete implementation with no loose ends or just a showcase thing.

It's important, because the app we are about to develop should have Windows GUI besides the main implementation on web. Having a language where the core code can be ported between two implementations looks like a deal maker.

Anyone worked on the .NET implementation of Scala? Any feedback?

4

8 Answers 8

27

I have heard new funding has been acquired for the .NET side, but at the moment it is a great and increasing distance from "production ready" or even "usable". There hasn't been a check-in which meaningfully touched the .NET side in a long time.

Update Jan 15 2010: A recent message to one of the scala lists.

From: Lukas Rytz

On Fri, Jan 15, 2010 at 03:18, Naftoli Gugenheim wrote:

Not sure if this is what you're looking for but I think H2 can be run on
.NET, according to its documentation/website.
If you're looking for a database engine programmed in Scala, personally I
haven't heard of any but that doesn't mean anything.
If you mean an ORM etc. there are a few. You can use Lift Mapper even in a
non-Lift application (just include the webkit and util jars IIRC).
What is the status of Scala on .NET?

We're working on bootstrapping the compiler and we're fixing MSIL-Backend-Bugs along the way. EPFL will provide a compiler running on .NET (which uses IKVM.OpenJDK.Core.dll, at least in a first version)

Right now, we have a cross-compiler running on the JVM, and a reduced version of scala-library.jar which runs on .NET.

For some parts we will rely on the community (e.g. porting more of scala-library.jar to .NET).

Lukas

4
12

Martin Odersky says in this SE Radio interview (January 2011):

I don't want to give you an estimated time of arrival but it should be certainly this year including visual studio support.

He starts talking about .NET at the 15 minute mark.

9

The Wikipedia entry claims:

An alternative implementation exists for the .NET platform, but it has not been kept up to date. (citation needed)

The "limitations" section of the FAQ has this entry:

Does Scala work on .Net?

Yes, the current Scala distribution can compile program for the .Net platform. The .Net platform has many similarities to Java but it has also many idiosyncrasies, making maintaining this port is a complicated task. The MSIL/.Net version of Scala implements at this stage virtually the entire Scala language, and most of the standard libraries. One significant limitation is that structural types do not yet work on .NET. There may still be problems when using particularly complex exception handlers. A small number of libraries are not available due to the peculiarities of .Net, and the interaction with other .Net languages is unsupported. For further details, please refer to this (possibly a bit outdated) documentation page.

The guide to using Scala with .NET talks about version 1.4, which is rather old by now. On the other hand, it looks like documentation was written as recently as 2008, including the "Scala on .NET: quirks" page which sounds pretty important.

Without having any experience of it myself, it sounds like support is limping along, but that the .NET port isn't really a first-class citizen. The fact that there's no "buzz" around Scala on .NET (compared with the Java version) isn't encouraging either. It doesn't sound like something I'd want to use for commercial software at the moment. Of course, it's possible that it's fine, and just not well marketed. If you're really keen on the idea, I'd ask on a mailing list.

Why not either use the Eclipse RCP for a Java/Scala-based Windows client, or use .NET for the web app?

4

In an interview on scala-lang.org on 18th July 2011:

Can I run Scala programs on .Net now?
Miguel:
The simple answer is yes, with a few limitations that will be remove by the fall.

Link: The inteview
Link: Binaries

3

At the moment -- no, not really, which is a great pity, since it's quite a fun language.

"Hello world" type programs, fine -- even fancy tricks like writing a simple stack where a small piece of Python (the same code under Jython or IronPython) drives the same piece of Scala.

Anything moderately taxing -- the scalac-net compilation can and will throw, even if the code doesn't use anything outside the scala namespace, and builds and passes a fairly exhaustive set of unit tests on the JVM. It can balk at building against even fairly simple assemblies (even if built using .net 1.0, to match the low spec of the mscorlib included in the scala-msil bundle).

My test-sets for "moderately taxing" have included the following implementations intended to compensate for current lacks on .net

  • a port to Scala of a C# library for BigInteger (from codeplex, with my own unit tests)
  • a port to Scala of the Java code in scala.actors
2

As of Scala Days 2010 in April, Miguel Garcia was working on Scala.NET. I believe he's working on a visual studio plugin and I'm not sure how far along things are, however you can find evidence of his work here:

http://lamp.epfl.ch/~magarcia/ScalaCompilerCornerReloaded/ http://www.sts.tu-harburg.de/people/mi.garcia/ScalaCompilerCorner/MixedSourceScalaCSharp.pdf http://www.sts.tu-harburg.de/people/mi.garcia/ScalaCompilerCorner/ScalaNetLearnsLINQTricks.pdf

Miguel is now doing his postdoc at EPFL: http://lamp.epfl.ch/~magarcia/

Paul (extempore)'s answer probably has more up-to-date information, but if I were curious I might ask Miguel directly.

2

DDJ: Is there a .NET version of Scala planned?

MO: Yes. We announced it in July. We have a project, which is actually funded by Microsoft, to build a .NET version of Scala. And we have the first bootstrap version of the compiler compiling itself on .NET. There is still work to do, especially on Visual Studio integration.

Interview with Scala's Martin Odersky - July 14, 2011

0

Looking in the SVN repo, there's definitely some activity going on in the .net space. In 2.7.x there was a dotnet-library directory, but that's gone in 2.8.x and trunk. Instead there is a msil directory which has had some non-trivial things going on as recently as 4 months ago by rytz.

All the documentation available seems to be way out of date, but maybe it's worth asking one of the main contributors what the current status is. Note that extempore (who as already answered this over a year ago) seems to be one of them.

Not the answer you're looking for? Browse other questions tagged or ask your own question.