Linear types and how they let you control the future

Higher RAII, and the Seven Arcane Uses of Linear Types (discussed on Hacker News) introduced me to the concept of linear types and how they can be useful. It turns out: they can be extremely useful, because you can use them to make a promise to do something to the compiler, and it will hold you to …

Implementing order books in C++ and Rust - part 3/3

In the previous part we have started working on our Rust orderbook re-implementation of the C++ original, and defined the types Order and OrderKey<Side>, where Side is a type implementing the OrderbookSide trait: either Bid (for buy orders) or Ask (for sell orders). Defining OrderHandle …

Implementing order books in C++ and Rust - part 2/3

In the previous part, we have sketched out the structure of implementing a simple order book in C++, supporting order insertion and efficient cancellation. (Implementing uncrossing, that is, trades when a buy order and a sell order agree on a price, is an exercise left to the reader, as is …

Implementing order books in C++ and Rust - part 1/3

A fairly standard programming problem in the world of trading is building an order book. In this article, I will be showing one particular interesting aspect of this problem, and how to solve it in C++. In the next two parts, we will be trying to implement the same solution in Rust. This is meant to …