Plurrrr

Mon 14 Mar 2022

Storing UTC is not a silver bullet

The general advice of “just convert all local date/time data to UTC and store that” is overly broad in my view. For future and near-past events, it doesn’t take into account that time zone rules change, making the initial conversion potentially inaccurate. Part of the point of writing this blog post is to raise awareness, so that even if people do still recommend storing UTC, they can add appropriate caveats rather than treating it as a universal silver bullet.

Source: Storing UTC is not a silver bullet, an article by Jon Skeet.

When or If

The CSSWG (CSS Working Group) is currently debating what to name a conditional structure, and it’s kind of fascinating. There are a lot of strong opinions, and I’m not sure how many of them are weakly held.

Source: When or If, an article by Eric Meyer.

Hacking sum types with Go generics

I’ve been writing Go professionally for five years now, and the feature I’ve wanted the most – more than generics, even – is a sum type.

Specifically, I want to define a type comprising several distinct values, and to write code that handles all possible values of that type which is checked by the compiler.

Such a type is key in large projects where the compiler should help you find modules that need updating when you extend the base sum type. With generics in go 1.18, it’s possible to write an ergonomic switch statement that can help polyfill for sum types, until they are supported properly.

Source: Hacking sum types with Go generics, an article by Lawrence Jones.