OCaml/Reason Compiler Hacking sessions. First announcement…

It’s time for me to organize my first event about OCaml (and in the same time, Reason), and more specifically something like the Compiler Hacking Sessions OCamlLabs holds in Cambridge.

It would be the first week-end of July 2017 (1st and 2nd) in my apartment in the south of Belgium near Ath (the address will be given to people who will participate, I don’t want to publish it on the Internet). Everyone can come, even if you don’t have any knowledge about compilers or type systems.
This week-end won’t be only focused on OCaml Compilers Hacking. I mainly organize this event to meet other developers, talk about technologies, things we like, share cultures, taste beers, eat Belgian fries (not French fries, it’s not the same, and fries are Belgian, not French…). But of course, code and learn will be the most important.

More information will come later like links to begin to hack with type systems, information about compilers. I will also post some hacks which can be interesting in the OCaml/Reason community. To OCaml/Reason maintainers, contact me if you have suggestions (maybe add some labels on the GitHub repository for contributions). Contributions can also be about the ocaml.org website, documentation, write documentations for next sessions, etc. No idea for the moment what we will work on.
I will also post later more practical information how to come to my apartment (from Brussels, it’s easy, it only takes one hour. I will help you, don’t worry about that).

The event will be free about registration and hosting. As it’s the first time I organize this type of events, I will only ask you to pay/participate for food and drinks (a special beer will be offered). Belgium is not really expensive, specially in my region. Around 20€ is enough for the weekend, we will see during the weekend how much food costs. I hope later I will be able to offer it (yes, I plan to reorganize it often). I will also ask to participants to register on an EventBrite event. People who are interested can already send me a message.

II can host maximum 6 people, and it would be the place for hacking for 8-9 people. If someone has a bigger place (with good Internet connection, no firewall, no Internet connection restrictions) and wants to host the event, please contact me. More people we can have, better it is. If you live near Ath and want to host some people for the night, you can also contact me. About the apartment, don’t worry about Internet connection (10Mbs) and places. We have two rooms around 15m2 where we can hack.

In the next few weeks, I will invest in some interesting stuffs like 50″ TV to make presentations, a huge meeting table and maybe hardwares to work on different architectures. I already have a raspberry pi 3, a rasp zero, a rasp 1B, I can have some Arduino microcontrollers, etc. Of course, you need your laptop and something to sleep on.

If you want to help to organize this event, or if you want to sponsor it by giving/lending stickers, hardware or anything else (screens can be very interesting, I have only two at home), you can contact me. I already thank OCamlLabs for stickers they will send to me.

More will come in the next few weeks. You can follow me on Twitter (@dwillems42) for up-to-date info or send me an email to contact@danny-willems.be. Hope there will be interested people!

OCaml + Cordova = more secured, typed and hybrid mobile applications.

Since several months, I began to be interested in mobile development. I found a job in Brussels in July 2015 where I learned how to develop hybrid mobile applications (one code = available for multiple mobile platforms) with Cordova and web technologies. I found it very interesting and after several month I continue to develop applications with this technology. I discovered a very great community about mobile development and some awesome frameworks like Ionic.

The majority of these frameworks use JavaScript as programming language but I don’t really like this language because you have no types, some weird things (equality between string and integer), parameters are sent as undefined if not passed, etc. I don’t really like to develop applications with JavaScript because it’s very ugly (even if I think it’s OK for prototyping, but not in production).

I discovered OCaml at the university, a very powerful programming language with inferred static type, type checking at compilation time, an extraordinary community and… a compiler from OCaml to JavaScript! So, I wanted to use this language to develop mobile applications with Cordova: it will be my university project for a semester.

The goal of my project is to be able to use native components of smartphones such like accelerometer, camera, send sms, etc in OCaml.

What are Cordova, js_of_ocaml and gen_js_api?

  • Cordova allows you to develop hybrid mobile applications using web technologies such as HTML, CSS and JavaScript. For more information, see the official website. Through Cordova plugins, you can access to the native components. To learn how to make Cordova plugins, see the official tutorial. You can find the official Cordova plugin list here.
  • js_of_ocaml provides a compiler from OCaml to JavaScript. Since Cordova applications use JavaScript, js_of_ocaml provides a way to develop mobile application using OCaml. For more info, see the Ocsigen project which contains js_of_ocaml.
  • gen_js_api aims at simplifying the creation of OCaml bindings for JavaScript libraries. It must currently be used with the js_of_ocaml compiler, although other ways to run OCaml code “against” JavaScript might be supported later with the same binding definitions (for instance, Bucklescript, or direct embedding of a JS engine in a native OCaml application).

All bindings are developed with gen_js_api and aims to be functional, typed and very close to the JavaScript interface.

Continue reading

GSMath

GSMath: a math hybrid library.

In the same idea than GSLib GSMath is a library, available in multiple languages, keeping the same structure and the same functions. GSMath provides functions to do linear algebra (matrix), differential analysis, basic algebra, trigonometry,…

What’s an hybrid library and why ?

I think programming languages must be seen as a tool, not as a “raw material”.

I don’t say every programming languages is equivalent in the sense there’re no needs to compare them. There’re better programming languages than other, and it depends on what you have to do. There’re also different theoric aspects of programming languages which matters a lot. For example, you’ve to be foolish to code a JQuery like or a web render in brainf***. As a tool, there’re better tools than other (but it’s not the subject of this article, maybe later).

I think a programming language must be seen as a way to communicate with your computer as you want: the compiler or interpreter is there to translate to your machine. So, why do we have to learn a new standard library when we learn a new programming language ? Why do we have to talk differently to each interpreters and compilators ?
It’s not very productive and we don’t often remember basic functions because we have to switch between different syntaxes.

You shouldn’t be afraid about the syntax and the semantic to learn a new programming language or when you work with several languages.

For these reasons, I began to write a library I called GSMath. I say it’s an hybrid library because you can use it in the programming language you want with the same namespace and the same algorithms for the implementation. The last point is I think important because when we want to learn a new programming language, it’s a good way to learn to study how standards libraries are implemented.

GSMath isn’t always the fastest and the more efficient implementations of math libraries.

GSLib

GSLib: an hybrid library.

When we learn a new programming language, we must read a lot of documentation to know which basic functions do what we want such as create a linked list, a tree, a graph, …
GSLib is a library, written in multiple languages, keeping the same structure and providing the same functions and data structures for all languages, which let you easily switch to a new language.

What’s an hybrid library and why ?

I think programming languages must be seen as a tool, not as a “raw material”.

I don’t say every programming languages is equivalent in the sense there’re no needs to compare them. There’re better programming languages than other, and it depends on what you have to do. There’re also different theoric aspects of programming languages which matters a lot. For example, you’ve to be foolish to code a JQuery like or a web render in brainf***. As a tool, there’re better tools than other (but it’s not the subject of this article, maybe later).

I think a programming language must be seen as a way to communicate with your computer as you want: the compiler or interpreter is there to translate to your machine. So, why do we have to learn a new standard library when we learn a new programming language ? Why do we have to talk differently to each interpreters and compilators ?
It’s not very productive and we don’t often remember basic functions because we have to switch between different syntaxes.

You shouldn’t be afraid about the syntax and the semantic to learn a new programming language or when you work with several languages.

For these reasons, I began to write a library I called GSLib. I say it’s an hybrid library because you can use it in the programming language you want with the same namespace and the same algorithms for the implementation. The last point is I think important because when we want to learn a new programming language, it’s a good way to learn to study how standards libraries are implemented.

GSLib isn’t always the fastest and the more efficient implementations of stardard libraries. For example, if you’re on an embedded system, use GLib is a better library because asm code is used to optimize on the platform.
Due to a bad manipulation, GSLib must be rewritten. A documentation and implementation in pseudo-code will be soon available.