POV-Ray : Newsgroups : povray.off-topic : Teach yourself C++ in 21 days : Frege Server Time
29 Jul 2024 10:27:21 EDT (-0400)
  Frege  
From: Invisible
Date: 9 May 2012 06:33:20
Message: <4faa47f0$1@news.povray.org>
>> When will we see the Haskell# language?
>
> I'm pretty sure the whole .NET bit is too OO to make that useful.There's
> way too much stateful stuff (like I/O) that you'd want to use from .NET
> to make it reasonable to have a purely function .net language.

I've been thinking for years that it would be cool to write a Haskell to 
Java compiler.

Yesterday night, I discovered that somebody has actually done this.

Specifically, there is a compiler which translates a language called 
"Frege" into Java. Frege is basically the same as Haskell, with a few 
tiny syntax changes. The compiler takes your Frege source code and turns 
it into Java source code, which the standard Java compiler then compiles 
as normal.

At the moment, it's all quite experimental. There's basically one person 
maintaining it, and it's still brand new. Documentation is nearly 
non-existent. The compiler is fairly slow, and error reporting leaves a 
lot to be desired. But it /works/.

I wrote 2KB of Frege code. The Frege compiler translated this into 47KB 
of Java code. The Java compiler then translated this into 12 class files 
totalling 30KB. The compilation process took just under 6 seconds.

Of course, the program I wrote is only a simple CLI thing for test 
purposes. The interesting question is "how easily can I use the features 
of Java?"

It looks like it only takes 1 line of code to turn an existing Java 
class into a valid Frege data type. (A data type which Frege then knows 
nothing about.) It takes a further 1 line of code to turn any Java 
method into a valid Frege function. I haven't actually attempted to use 
this yet, but there's some example code showing the creation of a Swing 
GUI from Frege. The example is only 50 lines long.

Clearly I'm going to have to play with this for much, much longer before 
I can say how truly /useful/ it is. It's pretty damned exciting though! :-D


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.