Pit - F# to JavaScript Compiler
Written by Ian Elliot   
Monday, 30 January 2012

Pit is a new open source project that compiles F# to JavaScript.

JavaScript is doing so many amazing things that you have to treat it as a first class high-level language, but for many programmings the idea that it is the new assembler is still sinking in.

There are already a number of languages that compile to JavaScript, including Dart and CoffeeScript, but mostly these are extensions or improvements to JavaScript.

Compiling strongly typed languages into JavaScript is a challenge, but JavaScript is already an object-oriented language and doesn't need to much extra machinery to implement types and class based inheritance. However, JavaScript also has another aspect. You can choose to view it as a functional language if you want to and, with a few additions such as map and apply and so on, it soon begins to look like a perfectly workable functional language.

So why not use it as a target for a compiler for a "real" functional language?

 

 

 

This is exactly what the Pit open source project is all about. Currently at a very conservative version 0.2, it can already be used to compile some quite impressive demos. In addition to working as a standard F# to JavaScript compiler it also can be used as a REPL (Read Evaluate Print Loop) in a browser. The only catch is that the REPL needs Silverlight to work, so it won't work in every browser.The good news is that the compiler produces very readable JavaScript.

 

Fsharppitrepl

 

As well as being an interesting project, and yet another proof of principle that JavaScript is usable as an intermediate language, it is also a potentially useful tool. There are a lot of advanced algorithms implemented in F# and now they can run in a browser as an HTML5 application. It also provides a much bigger platform for F# development. You can now decide to use F# with the expectation that you can develop using Visual Studio and a .NET environment with the idea of providing a web based version with the help of Pit.

Of course, any practical advantages depends on the project continuing until we reach a version 1 or even a version 2. At the moment there seems to be only two active members of the team, so if you think that this is a worthy project you might like to give them a hand.

 

More Information

Pit

Related Articles

JavaScript Inherits the Earth

blog comments powered by Disqus

 

To be informed about new articles on I Programmer, subscribe to the RSS feed, follow us on Google+, Twitter, Linkedin or Facebook or sign up for our weekly newsletter.

Banner


Python Tools for Visual Studio Gets New Focus
21/10/2014

PTVS 2.1 has just been released and now can be used for free with Visual Express. The more interesting news is that the PTVS team has become part of the Azure Machine Learning group and it PTVS2. [ ... ]



RomoCart Brings A Race Track To Your Living Room
11/10/2014

This is a small but innovative project that demonstrates what you can do if you think outside the box - or outside the screen. Is it AR, VR or just reality?


More News


Banner


Python Tools for Visual Studio Gets New Focus
21/10/2014

PTVS 2.1 has just been released and now can be used for free with Visual Express. The more interesting news is that the PTVS team has become part of the Azure Machine Learning group and it PTVS2. [ ... ]



RomoCart Brings A Race Track To Your Living Room
11/10/2014

This is a small but innovative project that demonstrates what you can do if you think outside the box - or outside the screen. Is it AR, VR or just reality?


More News

Last Updated ( Monday, 30 January 2012 )
 
 

   
RSS feed of news items only
I Programmer News
Copyright © 2014 i-programmer.info. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.