Walk like an egyptian

After quite some struggle, I finally got my OCaml env set up how I wanted it. I cursed at Atom, Merlin, Opam and pretty much any tool that could not hide quick enough, until I finally realised I just forgot to install the package highlighted as “unbound”. Now, with my hello world TLS client running, I am pretty amazed at the package management. Time for some planning.

I decided that a nice project would be to revamp my postfix address mapping server. That server maps an incoming email’s recipient address to the address that should be looked up in the database. Sounds simple enough — currently it’s just a python regex that removes dots, underscores, #suffixes — but it could use some features. For example, I’d like to be able to specify the applied maps without restarting the server, and adding temporary aliases on demand would also be nice. While I’m at it, I’d also like to get rid of MySQL in the process, but this strongly depends on the flexibility of dovecot. In the long run, I’d love to try out etcd, but there’s no OCaml native client available, and writing one will be difficult because ocaml-protoc does not support proto3 syntax yet.

So what is the mapping server going to look like? I imagine a specification of transformation/validation chains serialised as S-expressions, which would make them swappable at runtime. It also needs a bit of protocol implementation (request types and return codes specified by postfix) and socket handling. These two should be easy enough to figure out, but complex enough to give me some further insights into the OCaml world.


New Language Thursday - Reloaded

Let’s be realistic and reduce the list to something manageable in the next couple of months.

  • OCaml (now that I started it I want to continue)

    • Getting started: Either add some features to mtail, or start a new one.
    • Project: Mirage OS sounds interesting. Alternatively, I would love to take a look at the formal verification tools available. But it seems that although OCaml advertises as industrial grade language (which I honestly believe now), the list of industrial grade software …

And a roadmap

  1. Rust

    • Getting started: I really don’t know yet.
    • Project: ?
  2. Erlang

    • Getting started: I need to find some good resources on setting up dev env and stuff like this.
    • Project: no clue yet, but it should be something distributed.


Mid-term Evaluation of New Language Thursday

Wow, it’s been more than two years since the original new language Thursday post. Back then, I wanted to learn the following languages by (a) following a tutorial of some sorts and (b) apply my knowledge to a small task that (in the best case) leverages the unique features of the language. Let’s see how far I got.

  • Erlang: I did quite some tasks on HackerRank.com using erlang, but my postfix mail address server turned out to be not that interesting to write at all. Besides, deploying erlang projects reminds me of the whole maven mess.
  • Rust: Read a tutorial at 2am, stopped at the first incomprehensible borrowing section. I definitely want to try again, but I need a good project to motivate me.
  • Scala: Finally, a success story. I actually get paid for developing scala at SAP Big Data. Real world use cases are thus check-marked.
  • Julia: I abandoned this in an earlier post, didn’t I? If not, I’m abandoning Julia right here. It is still an underdog language in a world dominated by python and R, and neither do I need much number crunching nowadays nor am I convinced by it’s features.
  • Haskell: I’m pretty scared, let’s postpone this. But Bartosz Milewski does a pretty good job sparking my interest.

I think this can be scored as okay-ish. Apart from the shift from Thursday to Friday (not affecting the NLT trademark), I intend to revive this series. Perhaps now is a good time - I’m still in parental leave.


My first OCaml project

After I finished the MOOC on OCaml recently, I really wanted to use it in a real world scenario (as opposed to the web-based editor in the course). As it happens, I also required a command-line tool for disentangling log messages, so I went ahead and wrote it in Python first and reimplemented it in OCaml afterwards. It’s on GitHub. The python implementation took me about 1 hour (including tests and so forth) and was mainly to figure out what the software should do.

Main takeaway: OCaml is awesome, and the tools are as well. However, I spent most time on this project on getting oasis to run as I want it to (and I’m still not convinced that I have set everything up correctly). But seeing the man page created by Cmdliner is just worth all the trouble!