Global variables aren't the problem...

... global mutable state is the problem. Well, global variables are typically global state, so they are still a problem. However, the distinction is still important, since some design changes taken to remove global variables can actually make a program's design worse.

Read More »

Clean the source (nix)

Most experienced, or even intermediate, Nix users probably already know to clean their sources. However, I can't recall any Nix tutorials explaining how or why you should "clean the source". Simply, you should filter a source tree to remove version control files and build results. This prevents those files from contaminating the tree imported by the Nix builder, and this leads to more repeatable builds.

Read More »

Benchmarking with Go

The authors of the Go language have invested to ensure that benchmarking and profiling are well-supported by the language's tooling. This puts Go ahead of many other language, but the tools provided fall short of being sufficient. The standard tools don't handle measurement uncertainty, and so cannot (on their own) correctly answer basic performance questions.

Read More »

Sleep with Context

Go's standard library includes a useful function, time.Sleep, which pauses the current goroutine for at least the specified duration. This is all well and good, and commonly found in the standard libraries of many languages, but unfortunately the function is less useful in a post-context world.

Read More »