

Fjord – F# programming language for the JVM - agurha
https://github.com/penberg/fjord

======
Raphael_Amiard
To save anyone the trouble, this project is totally empty yet.

It doesn't say anything about the ability of the owner to port F# to the JVM,
but just know that it is just a readme, three almost empty java classes, and
the beginning of an ANTLR parser.

So to answer other questions here, you can't even compare it to F# on Mono. F#
on Mono works perfectly. The F# compiler and runtime is huge, and getting to
parity will probably take at least a year to a very dedicated team.

~~~
quasque
Perhaps of more interest is Frege, which is basically Haskell for the JVM.
Seems to be coming along nicely: <https://github.com/Frege/frege>

~~~
octo_t
surely you could just run lljvm on the llvm IR that ghc emits and have haskell
code on your JVM?

~~~
th0ma5
could you get the kind of adhoc library interop you get with other on-the-jvm
languages like this with llvm?

~~~
carterschonwald
probably not if you did it this week :)

That said, there is some very interesting work going on towards having a sane
call out to JVM / .net code from haskell, though nothing will realistically be
in a truly usable for in the next 12-18th months

------
lmm
Very pleased to see this. F# is a really exciting language, hamstrung by being
tied to the MS platform. Hoping we'll see more opensource F# projects as a
result.

~~~
thomasbk
F# has an open-source compiler and runs well on non-microsoft platforms using
Mono. How is it tied to the MS platform?

~~~
melling
What's the quality of code produced by Mono? How does it compare with
Microsoft's compiler? I'd like to see Mono C# and F# numbers compared against
Microsoft's compilers. Will I get 90% of the performance?

~~~
giulianob
There are games running on Mono (e.g. Unity C# scripts, Bastion was ported to
Mono to run in Chrome, etc..). I'm sure the performance of Mono may depend on
your specific application but many people have been using it without any
issues.

~~~
and21OS
the c# performance over mono is really different to the f# performance..while
c# has a decent performance on mono, f# doesn't performance so well......

~~~
profquail
You can run F# on the old "stable" branch of Mono (2.10.x), but I'd highly
recommend running Mono 3.0.x instead. The older version uses an older, simpler
GC which works OK for C#, but which seems to have trouble with F# (which
generates more G0 objects than C#). The new 'sgen' GC in Mono 3.0 is a huge
improvement though, so you shouldn't see much (if any) performance difference
between F# and C# apps.

------
jon_smark
Since F# was derived from OCaml, I think readers may also be interested in
taking a look at the OCaml-Java project: <http://ocamljava.x9c.fr/>

(It's essentially what it says in the tin...)

~~~
fhars
Or scala, which is an acceptable ML if you ignore the OO parts :-).

~~~
kvb
It's really not. Scala is a very interesting language, and it incorporates
many functional features, but it's not at all ML-like. In particular, type
annotations are needed in many, many places where they would be superfluous in
an ML-derived language.

~~~
mafribe
As a recent migrant from Ocaml to Scala (due to stagnation of Ocaml), I have
to say that you are quite right about type-annotations, but the style of
programming that an Ocaml/F# person would be accustomed to is quite easily
replicable using Scala.

~~~
jon_smark
What do you mean by "stagnation of OCaml"? There was a period some 4-5 years
ago where it did seem like there was little development on the language, but
things have changed quite a lot since then. Lots of developments in the core
language (including first-class modules and GADTs!), and a blossoming of the
ecosystem around it. To me, it seems OCaml has never been livelier than now...

~~~
mafribe
Let me start by saying that I <3 Ocaml. I've used it intensively for over 10
years.

By stagnation I mostly meant the comparatively tiny ecosystem of libraries
vis-a-vis, e.g. JVM-based languages. In particular, with Akka, Scala has much
nicer support for concurrency. The ability to call, and be called by, Java
code in the smoothes possible way is also beneficial for my use cases.

I'm surprised that GADTs were added, because a few years ago I visited the
Gallium team at INRIA who develop Ocaml, and asked about GADTs. I was told by
one of the senior Ocaml developers that there were no plans for the inclusion
on this feature.

------
jstclair
Has anyone tried running the F# through IKVM[1] (.Net <-> java)? That wouldn't
solve this, but it should be possible to run F# on a JavaVM.

[1] <http://weblog.ikvm.net/>

~~~
daeken
IKVM runs JVM code on .NET, not the other way around.

~~~
skrebbel
That may not be a practically relevant difference. Why would you want to run
F# on the JVM? To interface with JVM code. IKVM lets you do that already.

I've rolled out multiple .NET programs that contain Java open source libraries
through IKVM. It works just fine, and the amount of extra work you need to do
to make the JVM->.NET mapping work is remarkably little.

~~~
lucian1900
Or perhaps you'd wish to run F# on the JVM because you like the language, but
don't wish to depend on .NET (or Mono).

------
lysium
How is this supposed to work given the JVM does not support tail calls?

~~~
clhodapp
In general speech, I can get behind the idea that you shouldn't correct
someone if you understand what they mean. In programming, however, I think
it's important to be pedantic.

You must mean tail call optimization/elimination here. Clearly, the JVM
supports tail calls.

~~~
lysium
If you want to be pedantic, the JVM does not support tail (function) _calls_,
but jumps, which may be the result of tail call optimization or elimination.

As far as I know, we still cannot efficiently turn mutual recursive calls into
a chain of jumps, but I'll be glad to be corrected here.

~~~
clhodapp
I think there may be a misconception here: A tail call is NOT a call that
doesn't allocate a stack frame. A tail call is a call that is the return value
of a function. This is why we refer it the stack frame-eliminating
optimization as "tail call elimination". We are taking a jump-to-subroutine
(call) instruction and replacing it with a normal jump instruction, thus
eliminating a "call" from our program.

The JVM most certainly does support general tail calls through its invoke
instruction, which supports calls to arbitrary methods of arbitrary objects
(which, of course, includes tail calls).

Some compilers also support the optimization of _some_ recursive tail calls
(usually recursive tail calls to final or local methods) into loops using the
goto instruction, which supports jumps within the current method (essentially
optimizing the tail-recursive method into a non-recursive method containing a
loop).

~~~
lysium
Thanks for the clarification.

If I read you correctly, you say, the JVM 'supports tail calls', because it
can call other methods. I think, the phrase 'supports tail calls' is as
meaningful as 'supports function calls' then.

In any case, I don't think this is a question of optimization. I don't see
how, for example, an F# program written in CPS can ever run on the JVM.

------
niggler
How does mono's F# coverage compare to this?

~~~
Lewix
F# works very well on Mono. You can compile and use the open-source edition of
the F# compiler [1] on both Linux and on OS X (though I haven't tried OS X).

This port is in very early stages, and only has the start of a lexer as far as
I can see.

[1] <https://github.com/fsharp/fsharp>

~~~
profquail
FYI, F# 3.0 is shipped as part of the Mono package for OS X.

It's also available through the FreeBSD ports system:
<http://www.freshports.org/lang/fsharp/>

~~~
profquail
(Replying to myself, since I can't edit the post now...)

More info on F# 3.0 + Mono 3.0 + FreeBSD can be found here:
[https://groups.google.com/forum/?fromgroups=#!topic/fsharp-o...](https://groups.google.com/forum/?fromgroups=#!topic/fsharp-
opensource/lKLFxHq4oc8)

Arch Linux users: the thread I linked also has instructions on how to
build/install F# 3.0 and Mono 3.0, if you're interested.

------
jackfoxy
There is a good technical thread started on stackoverflow
[http://stackoverflow.com/questions/15731724/whats-the-
easies...](http://stackoverflow.com/questions/15731724/whats-the-easiest-way-
to-build-an-f-compiler-than-runs-on-the-jvm-and-generate)

------
kawas44
F# <\- Ocaml <\- ML language

Have a look at Yeti ? <http://mth.github.com/yeti/>

