Writing mutexes from scratch in Go
Did you know that in programming, threads have been locking in before it was cool?
Did you know that in programming, threads have been locking in before it was cool?
When you first encounter a Bongard problem, it’s a bit like hearing a joke, and everyone but you already knows the punchline. You’re given a set of six images on the left, and another six images on the right, and you’re told that all of the images on the left have something in common, but the images on the right don’t. That’s it. No choices, no hints. You might “pick it up” quickly… or you might…
Many languages may have interesting ideas motivating them, or have a variety of ways to make you feel more productive – but I don’t think these qualities are what make great programming languages great.
They can be done, but it’s an uphill battle.
One of my interests in programming is making software for other software engineers. Software development requires building up big things from lots of little things, so a concept that’s on my mind a lot is the idea of the “primitive”. The word primitive comes from the Latin prīmitīvus, which means “first or earliest of its kind.” But the definition I like to use is that a primitive is a building…
[^1]: Go's built-in map type isn't concurrent safe. There's a [`sync.Map`](https://pkg.go.dev/sync#Map) type that can be used as an alternative, but it's generally not recommended unless you have done performance testing to confirm it's faster since it adds overhead in some scenarios. [^2]: The way `wait()` works in Java is it pauses the current thread, only waking it up once until either (a) a…
Wing (or Winglang) is a general-purpose programming language designed to make it easier to build cloud applications. This post isn’t meant to be an introduction to the language, so if you want to learn more about how it came about or what it’s like to write code in it, see this blog post or the Wing docs.
I recently finished reading through Crafting Interpreters - a book I’d have to vouch for as the best introduction to writing interpreters or compilers.
Something I recently pondered on was how the software industry has consistently been developing novel mechanisms for efficiently sharing and reusing resources. Memory is probably the most straightforward resource to reuse, but other resources need to be shared as well. Below, I listed some examples that come to my mind – you’ll see they range from simple data structures to complex systems.
I’ve noticed a small but interesting trend in the programming languages space. I’m not sure how novel it is, but this pattern, which I’ll refer to as “biphasic programming,” is characterized by languages and frameworks that enable identical syntax to express computations executed in two distinct phases or environments while maintaining consistent behavior (i.e., semantics) across phases. These…