Haxe and OCaml united: followup!

Posted by
|

Haxe and OCaml by Pol ;)

One month ago, on May 3 2012 Alex Hoyau from Silex Labs, presented Haxe, Cocktail and NME to a public composed of INRIA researchers, academics and members of the IRILL non profit organization. He was backed up by a bunch of Silex Labs regulars, which was very appreciated because the OCamlers did have a bunch of tricky questions for the president…

We have discovered a much alive community, new projects and great people.
Several new ideas came up, as a proof that mixing is good, and that there is a will to collaborate to make something big together!

Read this article to know what you can do to help Silex Labs make the bridge between the OCaml and the Haxe communities. Leave comments to support this action. Join the working group « Haxe/OCaml Mix »

After this contact  we initiated a relationship with old timers of the Caml language – a must read « A brief history of Caml » and we continues to explore a new world for you …


A short presentation of Haxe

Conference by Silex Labs: OCaml and Haxe unitedThis presentation was a clash of cultures, where the mountains meet, an experimental mix of complementary visions! Shortly after the start of the presentation it took an unexpected path, since most of the questions which were asked in the first ten minutes showed that people in the room had already understood what Haxe does, and how it works. And the questions about language theory began to fall like rain… Without any answers from the Haxers in the room. So we agreed that this is only a short introduction, that we would meet online to answer these very specific questions.

“Please consider that the approach of many APIs with the same syntax seems trivial to us. What would be interesting is to talk about the choices made in the compiler to implement the different programming concepts in the target languages.” – Emmanuel, professor at the University of Paris VI.

And this was already a very good point: OCamlers are interested in what we have achieved with Haxe. In particular the many targets, and some innovative libraries – i.e. NME. Also the very short part about Silex Labs, and Silex seemed to evoke reactions: communication, production and WYSIWYG surprisingly are words which interest our cousins OCamlers.
“What you said at the end as an aside is precisely what we find complicated.” – Basile, researcher at CEA, LIST, working on the famous GCC compiler and MELT.

So we switched from a talk to an open discussion, exposing facts about the amazing job made by the Haxers based on the OCaml work. The fact that the OCaml skills are not common in our community lead us to talk about the possible interactions, about the impact of such interactions, about the actors of the OCaml community, and about the lack of communication between our two worlds.

“We saw Nicolas Cannasse a few years ago, with his great vision. It is great to see that Haxe is not only game oriented anymore… And there are so many targets and nice looking apps, I will definitely try it on my spare time!” – A a student attendee.

The OCaml ecosystem

The Haxers there had the chance to talk with active members of the much alive and very discreet OCaml community. We discovered several innovative projects with roots in OCaml.

The online demo of the OCaml language, is made by OCaml Pro, a company specialized in OCaml. This online demo loads in the browser, lets you manipulate the javascript dom of the page in OCaml, with the OCaml interpreter compiled in javascript. This is possible because OCaml compiler itself is written in OCaml, and there is a javascript converter of OCaml bytecode, called JS of OCaml.

 

A more ambitious project getting famous these times is Ocsigen, a web server which serves compiled OCaml code. The client side code and server side code of a module are mixed in in the same file, which let the developers design very natural and logical application architectures. The server also enables a new control of security and validation of web applications, since all HTML inputs and outputs are parsed and validated at runtime.

The Ocsigen project is maintained by Vincent Balat with the help of the IRILL non profit organization and many contributors.

And last but not least, we had the chance to discover Opa, a platform for writing web applications in a very innovative way. It is close to the Haxe and Ocsigen approach, but the whole platform is a blast.

  

These discoveries have been a blast to us, Haxers unconscious of these initiatives which happen so close to ours, and especially to us, French based developers, with these French born technologies. And we say we have a great product but lack visibility and communication? Now we know that… We are not alone!

And this is a good news because our fellow OCamlers are very friendly to us.

New ideas

So after this epic moment, we have retained several ideas to interact between our two worlds – i.e. Ocaml and Haxe, research and production, public/state and private/corporate.

Development matters

The simplest thing to do right now with Haxe and OCaml communities together, would be to use JS of OCaml to convert the Haxe compiler into javascript. It should be quite straightforward, and it would allow to run the Haxe compiler on the client side… So the try Haxe page could be a standalone HTML page, just like the try OCaml page.

On the other hand, the conversion of OCaml bytecode to Haxe source code is possible. Indeed it is not so complicated since the whole JS of OCaml project was done in under 2 month of programming by a talented OCaml coder (source?).

This would make possible several “crazy” things:

  • convert the OCaml code, libraries and projects in Haxe, which would empower OCaml with as many targets as we have got in Haxe. Plus all the OCaml code out there – mostly research and financial applications, would be translatable to Haxe source code. This could be a motivation for OCaml developers to consider learning Haxe in complement to their current skill set.


  • Since the Haxe compiler itself is written in OCaml, it could be translated in Haxe, which is a great perspective for us, Haxe developers, isn’t it?
  • the Haxe compiler could then be compiled to all our targets and become a cross-platform compiler/interpreter to cross-platform languages, for native and web applications – complex apps only since it would probably be heavy, even if the OCaml compiler in javascriptweight less than 550KB. 
  • the Haxe compiler could probably be compiled in php, java, .net and neko – and maybe nodejs, which may be interesting for hosted solutions and on the fly compilation – this would have an immediate application with Silex v2 and Cocktail to compile Haxe javascript/CSS/HTML applications to native and web applications on the server side

Another work area could be to target OCaml with Haxe source code. This is « just » another target for Haxe. Nobody could really tell how useful that could be… At least if we could find the resources to do that, this would be made by OCaml developers and they would have to create a new Haxe target, which would probably take them to documenting and improving this process.

Language theory and research matters

The idea here is that it seems easier to find funding to back a thesis than to back a development.

A PhD student or a researcher would probably be able to do one or more of these tasks as part of a thesis or a research unit

  • audit and documentation of the Haxe compiler and the targets
  • proposals for evolutions of the compiler to gain in productivity, maintainability, and have an easier learning curve, …
  • proposals for the evolution of the syntax, the macros, the libraries
  • proposal to make the implementation of new targets easier and more maintainable
  • proposal to make Haxe a provable language (source? explanation of this?)
  • write the specifications of the Haxe language
  • a comparison of Haxe and OCaml : syntaxes, productivity, maintenability of the applications, learning curve, the organization of the whole projects and communities…

Please submit ideas and remarks in the comments. This is probably the most important matter to discuss, since it is the most likely to occur in the short run.

Next steps

As Silex Labs members, we have said that we will help OCaml to communicate – very simply to start, so we planned an interview of two key members of OCaml community, maybe in partnership with a parisan web radio. The goal is to spread the world about OCaml, as well as to introduce the OCaml ecosystem to the Haxe community.

To help several OCaml developers to find answers to their questions, we have opened the « Haxe/OCaml mix » working group, and we invite volunteer Haxe developers to start a (two way) discussion with them there.

Silex Labs is investing time in networking with OCaml community members, to make several of the ideas explained above to become a reality. We will try to fund a study, a thesis or a development, and make our best in community management in order to start a movement with inertia.

Silex Labs, open source projects

And finally, this could lead to several partnerships with Silex Labs, IRILL, Ocsigen, OCaml Pro, … Who knows?

Special thanks

Thank you to

  • IRILL for the invitation
  • the audience – and especially the enthousiasts Benjamin C., Gregoire H., Denis C., Basile S, Vincent B., Fabrice LF, and the organizers Roberto and Emmanuel who also supervised the meeting
  • Alex Hoyau for helping with this article and initiating this movement
  • Raphaël H. for the twitts and pics
  • Isabelle, Pol, Nicolas, Yannick and Raph for their presence and encouragements
  • Haxe et OCaml for being such great tools, and making all this possible!

Événements à venir / Upcoming Events

  1. Silex Labs Apéropensource #44 – Edition du mois de Septembre

    28 septembre @ 19:00 - 22:00
  2. Atelier SQL : Découverte du SQL avec MySQL

    3 octobre @ 19:00 - 21:00
  3. NodeJS, je commence où ?

    19 octobre @ 19:00 - 21:00

News letter

Evénements Silex Labs sur Paris et sa région: Inscrivez vous à la Newsletter mensuelle

Silex Labs community Tweets

Facebook page

Abonnez-vous aux news via Email

Rejoignez 45 autres abonnés