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?

Kyle Alons
  • 6,955
  • 2
  • 33
  • 28
CDR
  • 8,198
  • 11
  • 47
  • 46
  • 1
    What do you mean, port between the two? If you are using Scala.NET, you'll be programming against Winforms (or WPF), and with Scala on Java, against Swing or another Java GUI framework. It won't make your code magically portable between .NET and Java. – Matthew Olenik Apr 13 '09 at 06:32
  • It's possible to use the latest Scala (atm v2.8) with .NET: http://tountas-software.blogspot.com/2010/07/scala-on-net-via-ikvm.html – Nikolaos Jul 26 '10 at 17:01
  • Here is an update from march 2012 [A preview of Scala.NET: Cross-platform development the Scala way](http://lampwww.epfl.ch/~magarcia/ScalaNET/2011Q2/PreviewScalaNET.pdf) Other details and tools here: [All about the Scala.Net Compiler. A collection of resources for compiler hackers](http://lampwww.epfl.ch/~magarcia/ScalaNET/) – JackNova Nov 10 '12 at 16:45
  • This fellow has [a guide to using Scala 2.7.1 on .NET](http://hestia.typepad.com/flatlander/2009/01/getting-started-with-scala-on-net.html). Looks like it is not perfect, but it might get you a lot closer. – J. Perkins Apr 21 '09 at 17:38

8 Answers8

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

psp
  • 12,138
  • 1
  • 41
  • 51
  • 2
    Things are looking more favorable as of July 2011: http://www.scala-lang.org/node/10299 – jhclark Sep 17 '11 at 13:12
  • @extempore, can you, please, update status of .net? is there any changes since '10? – om-nom-nom Sep 20 '12 at 00:51
  • @om-nom-nom Anything changed since '12? – Display Name Jun 25 '13 at 03:54
  • 1
    @SargeBorsch the changes are disappointing: [the guy who worked on .NET part](http://lampwww.epfl.ch/~magarcia/) announced that .NET backend will be discontinued for now and he will work tightly on a [reference backend improvements](http://magarciaepfl.github.io/scala/). .NET is already [cut out](https://github.com/scala/scala/pull/1724). – om-nom-nom Jun 25 '13 at 09:15
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.

Brownie
  • 7,688
  • 5
  • 27
  • 39
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?

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
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

Brownie
  • 7,688
  • 5
  • 27
  • 39
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
Steve Gilham
  • 11,237
  • 3
  • 31
  • 37
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.

jsuereth
  • 5,604
  • 40
  • 40
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

QrystaL
  • 4,886
  • 2
  • 24
  • 28
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.

t0rx
  • 363
  • 2
  • 8