(a bit of) whitespace

Has someone just said “lowlevel”?

A Guide to Extension Points in OCaml

Extension points (also known as “-ppx syntax extensions”) is the new API for syntactic extensions in OCaml. The old API, known as camlp4, is very flexible, but also huge, practically undocumented, lagging behind the newly introduced syntax in the compiler, and just overall confusing to those attempting to use it.

Extension points are an excellent and very simple replacement introduced by Alain Frisch. In this article, I will explain how to amend OCaml’s syntax using the extension points API.

XCompose Support in Sublime Text

Sublime Text is an awesome editor, and XCompose is very convenient for quickly typing weird Unicode characters. However, these two don’t combine: Sublime Text has an annoying bug which prevents the xim input method, which handles XCompose files, from working.

What to do? If Sublime Text was open-source, I’d make a patch. But it is not. However, I still made a patch.

If you just want XCompose to work, then add the sublime-imethod-fix PPA to your APT sources, install the libsublime-text-3-xim-xcompose package, and restart Sublime Text. (That’s it!) Or, build from source if you’re not on Ubuntu.

However, if you’re interested in all the gory (and extremely boring) details, with an occasional animated gif, read on.

Page Caching With Nginx

For Amplifr, I needed a simple page caching solution, which would work with multiple backend servers and require minimal amount of hassle. It turns out that just Nginx (1.5.7 or newer) is enough.

Foundry Has Been Cancelled

Two years ago on this day I started working on Foundry, and I developed some nice things, including prototypes of both the language and the compiler. Today I’m cancelling the project.

The reason is simple and technical. The idea behind Foundry was to take the convenience Ruby offers, and transplant it to a statically typed language. My chosen implementation path involved global type inference in every interesting aspect of it. While powerful, this technique makes writing closely-coupled, modular code hard, separate compilation impossible, and error messages become even more cryptic than those of C++.

Simply put, this is not a language I myself would use. Also, I could not find a way to get rid of global type inference which didn’t involve turning the language into a not invented here version of C#, Rust or what else.

Lessons? Don’t design a language unless you have a very good reason to. By all means, do design a language if your idea is fancy enough. And don’t use global type inference, it sucks.

Now go and check out Rust. It gets better every day.

Metaprogramming in Foundry

The language I’m working on, Foundry, is developed as a practical alternative to widely used systems programming languages, in particular C, C++ and variants of Java. As such, it is statically typed, can elegantly expose machine-specific details when required, and is tuned to provide predictable and efficient (in that order) space and time behavior.

In this article, I present a way to add dynamic, Ruby-style metaprogramming facilities to a statically compiled language with an ML-derived type system.

The Next Web

The Web has grown out of JavaScript, HTML, CSS and HTTP. It is evident that the whole technological stack must change, yet the direction is unclear. In this post I present a few draft ideas for a next generation of web browsers.

Let’s Play With Ruby Code

Are you tired of aligning those pesky equality signs by hand? Do you obsess over using (or not using) and, do and then? Do you want to enforce your corporative style guide without fixing all the indentation by hand?

All of the above, and without accidentally breaking code structure and unrelated formatting?

Parser has you covered.

Unmentioned Features of Ruby 2.0

It has been a while since the release of Ruby 2.0, and a lot of comprehensive guides to the new 2.0 features were written. However, I feel that some of them are still left in obscurity. The justice shall be served.

Ruby Hacking Guide Ch. 11: Finite-state Scanner

Foreword

The following is a translation of a single chapter from a Japanese book Ruby Hacking Guide (Rubyソースコード完全解説, ISBN 4-8443-1721-0), written for the people who want to understand the source code of Ruby MRI better. The book covers Ruby 1.7.3; however, the parts of parse.y discussed in this chapter are still the same in Ruby 2.0.

I’m very grateful to my employer Evil Martians, who sponsored the work, and Nikolay Konovalenko, who put more effort in this translation than I could ever wish for. Without them, I would be still figuring out what COND_LEXPOP() actually does.