Blog

See selected articles, grouped by topic. Feeds: Atom, RSS.

  • Git worktrees and pyenv: developing Python libraries faster

    It’s glorious to work on one task at a time, to be able to take it from start to finish completely, and then move onto the next one. Sounds great, but reality is messier than that and context switches are common. Doing so can be annoying and inefficient, but not switching means tasks and colleagues are delayed. I combine git worktrees and pyenv (and plugins) to reduce the overhead of a context switch and keep development and collaboration as smooth as possible when working on a Python library.

    Read more
  • Myths and Legends about Integer Overflow in Rust

    The primitive integer types supported by CPUs are finite approximations to the infinite set of integers we’re all used to. This approximation breaks down and some computations will give results that don’t match real integers, like 255_u8 + 1 == 0. Often, this mismatch is something the programmer didn’t think about, and thus can easily result in bugs.

    Read more
  • Memory Leaks are Memory Safe

    Memory unsafety and memory leaks are arguably the two categories of bugs that have received the most attention for prevention and mitigation. As their names suggest, they are in the same part of “bug space”, however they are in some ways diametric opposites, and solving one does not solve the other. The widespread use of memory-safe managed languages hammers this point home: they avoid some memory unsafety by presenting a “leak everything” model to programmers.

    Read more
  • Rreverrse Debugging

    Imagine being able to step forward and backwards as code runs in your debugger. Imagine being able to do an test run multiple times with exactly the same sequence of instructions and values, right down to memory addresses and IO. Imagine being able to run an executable thousands of times and then do all that in the one execution that triggers the rare bug that’s draining you of life…

    Read more
  • simple_parallel 0.3: Revisiting k-NN

    I recently released version 0.3 of my simple_parallel crate, which builds on Aaron Turon’s crossbeam to resolve the stability and safety difficulties: the crate now works with Rust 1.3.0 stable, and offers safe data-parallel for loops and maps.

    Read more
  • SIMD in Rust

    A new scheme for SIMD in Rust is available in the latest nightly compilers, fresh off the builders (get it while it’s hot!).

    Read more
  • What is SIMD?

    I’m currently in San Francisco doing an internship at Mozilla Research, working on creating functionality for SIMD in the Rust programming language.

    Read more
  • travis-cargo 0.1.3: --no-sudo

    I just pushed travis-cargo version 0.1.3, which adds a --no-sudo command to the coveralls and coverage subcommands to allow recording/uploading test coverage without needing sudo.

    Read more
  • Announcing Primal: Putting Raw Power Into Prime Numbers

    Over the past few weeks I’ve been working on improving my slow_primes library, culminating in needing rename and the 0.2 release of primal, a Rust crate for computing properties of prime numbers with state-of-the-art algorithms, while still maintaining an idiomatic and easy-to-use interface.

    Read more
  • Defaulting to Thread-Safety: Closures and Concurrency

    Rust has some powerful tricks to model properties of aggregate types via unsafe traits with default and negative implementations. These features motivated by offering flexible concurrency/parallelism, and allow powerful closure-based APIs without losing any thread-safety (or memory-safety) guarantees at all.

    Read more
  • Rust 1.0 in Numbers

    Rust 1.0 was made with0

    1. I’ve tried to get the numbers that apply leading up to 

    Read more
  • Finding Closure in Rust

    Have you ever used an iterator adapter in Rust? Called a method on Option? Spawned a thread? You’ve almost certainly used a closure. The design in Rust may seem a little complicated, but it slides right into Rust’s normal ownership model so let’s reinvent it from scratch.

    Read more
  • Where Self Meets Sized: Revisiting Object Safety

    The concept of object safety in Rust was recently refined to be more flexible in an important way: the checks can be disabled for specific methods by using where clauses to restrict them to only work when Self: Sized.

    Read more
  • Travis on the train, part 2

    After announcing travis-cargo a few days ago in Helping Travis catch the rustc train, I got some great hints/contributions from Jan Segre and had a fun little time automating code coverage collection via coveralls.io. Unfortunately, this is a breaking change for existing users of travis-cargo, but the migration is easy.

    Read more
  • Helping Travis catch the rustc train

    I’ve been putting off configuring my continuous integration settings to match the Rust train model: it involves non-trivial branching on the configuration, and duplicating that over a pile of repos is not something I looked forward to. So, instead, I wrote travis-cargo to make things easier.

    Read more
  • Little libraries

    I’ve been having a lot of fun recently solving “little” problems in Rust. I have a long term project to make something for displaying my (GPS-tagged) photos nicely and, along the way, I’ve discovered and filled in a few gaps by creating focused crates for small tasks.

    Read more
  • Rust infrastructure can be your infrastructure

    Update 2015-06-16: Homu is now available online: homu.io

    Read more
  • Some notes on Send and Sync

    If you’ve been in the #rust-internals IRC channel recently, you may’ve caught a madman raving about how much they like Rust:

    Read more
  • Rust Sydney's first meetup: trip report

    Rust Sydney had its first event last Monday! The first Rust gathering I know of in Sydney, in Australia, or in the whole southern hemisphere.

    Read more
  • Object Safety

    A trait object in Rust0 can only be constructed out of traits that satisfy certain restrictions, which are collectively called “object safety”. This object safety can appear to be a needless restriction at first, I’ll try to give a deeper understanding into why it exists and related compiler behaviour.

    1. As usual, this post is designed to reflect 

    Read more
  • The Sized Trait

    An important piece in my story about trait objects in Rust0 is the Sized trait, so I’m slotting in this short post between my discussion of low-level details and the post on “object safety”.

    1. Per the previous post, this post is 

    Read more
  • Peeking inside Trait Objects

    One of the most powerful parts of the Rust programming language0 is the trait system. They form the basis of the generic system and polymorphic functions and types. There’s an interesting use of traits, as so-called “trait objects”, that allows for dynamic polymorphism and heterogeneous uses of types, which I’m going to look at in more detail over a short series of posts.

    1. It’s generally good practice for Rust posts to mention 

    Read more
  • crates.io crate graph

    Rust is a systems programming language that comes with an awesome package manager Cargo, which hooks into the crates.io registry as one of its possible sources of packages. The packages can have dependency relationships between each other, making the database into a natural directed graph.

    Read more
  • What does Rust's “unsafe” mean?

    Rust is an in-development0 systems programming language with a strong focus on no-overhead memory safety. This is achieved through a powerful type system (with similarities to Haskell), and careful tracking of ownership and pointers, guaranteeing safety. However, this is too restrictive for a low-level systems language, an escape hatch is occasionally required. Enter the unsafe keyword.

    1. The code in this post compiles with rustc 0.12.0-pre-nightly (aa0e35bc6 2014-07-22 00:26:21 +0000)

    Read more
  • Error handling in Rust: a k-NN case study

    After posting a Rust translation of some k-nearest neighbour code, I got a few comments asking “how would you handle errors if you wanted to?”. This is the perfect chance to briefly demonstrate a few idioms.

    Read more
  • Comparing k-NN in Rust

    In my voyages around the internet, I came across a pair of blog posts which compare the implementation of a k-nearest neighbour (k-NN) classifier in F# and OCaml. I couldn’t resist writing the code into Rust to see how it fared.

    Read more