Parametricity in Go

One of my objections to Erlang is that despite paying the price of being a functional language, it often fails to reap the advantages. An example of this is in testability; nominally, a purely functional bit of code ought to be easier to test than the imperative equivalent, because it is just a matter of setting up your parameters and checking the results, with no IO or state in between.

Erlang doesn't make this impossible, but it's less convenient than the brochure promises. The core of your application is generally locked up in the various gen_* handlers. These handlers have very stereotyped ways of being called, which include the full state of the thing being tested. I find this very tedious to test, for two reasons: 1. Every test assertion must define some sort of "complete state" for the handler, which is probably full of real-world concerns in it. In particular if it has further messages it is going to send, those are often relatively hard-coded somehow... an inconvenient-to-mock Mnesia entry, an atom-registered process name, etc. (Erlang programs end up having a surprising amount of global state like that.) 2. If you want to test some sort of sequence of events, you are responsible for threading through the code, or manually invoking the proper gen_* start up functions, or something. It's possible to refactor your way out of this mess, but in practice it's a lot of work for the reward. So many of the tools you could use in other languages aren't available.

Go, in theory, ought to be harder to test than Erlang, being an imperative programming language. In practice, I'm finding it much easier, and I'm doing a lot more testing in it.

Mathematical Diversions: Producing Helium from Hydrogen

In response to this story about a possible impending Helium shortage, someone suggested on Hacker News that perhaps someday we can use nuclear fusion to produce helium.

As it happens I'd idly chatted with my wife about that a few weeks ago, but that wasn't enough motivation to run the numbers. This was. Could we produce enough helium to satisfy our commercial production of it through fusion, if we just assume we have fusion?

I had a dream this morning that my workplace had so suddenly shut down that there was nothing in the office when I got there, except a sign telling us that due to financial shenanigans the entire office had to be immediately liquidated, and a whole bunch of my coworkers milling around being angry about it.

Since I work for a tech company, this is quite silly. The assets of a tech company aren't anything interesting at all compared to the people, and an emergency fire sale would hardly recover anything of value.

It is important to use a cartridge of the appropriate size for your target. Shooting a [UAV] drone with .22 rimfire for instance would be cruel. You need something that will kill the drone, not make it suffer. - jlgreco on HN

Browsing through some old entries, I see in late 2007 I predicted:

One of the milestones I've been watching for is the first entirely DVD-based TV-style series. It's going to happen sooner or later, and will mark a major shift in how TV is produced, once it becomes possible to make it without advertising or subsidy, the only two models that currently work.

I'm going to give myself only half-a-point. True television-style "seasons" of shows have indeed now been produced without ever being "aired", but they didn't go straight-to-DVD. They went straight-to-streaming. I believe it was either Lilyhammer or House of Cards, depending on how picky you're being about not showing up on TV at all before being available via streaming. (Lilyhammer's first episode premiered on a Norwegian television channel, though this was clearly a publicity stunt rather than an attempt to "air on TV".)

An Open Letter To Meijer

Dear Meijer Corporation:

I love you guys. You guys are great. I know it's tradition for Internet "open letters" to be extended complaints, but nah, you're great.

But you know, I do want to air just one tiny grievance. 'Cause this is the Internet and all, and that's what we do here. But rest assured, it's just a tiny little thing. Hardly worthy of note. But I thought I should point it out anyhow.

Sum Types in Go

A couple of months back, I analyzed whether I wanted to propose switching to Go for work. I've still technically got the blog post with the results of that analysis in the pipeline (though who knows when I'll get it up), but there's a part of it that keeps coming up online, and I want to get this bit out faster. It's about whether Go has "sum types".

The BOAC Fallacy

An article about why virtual worlds died reminded me of a pet theory, by virtue of not mentioning it as one of the possibilities. I call it the BOAC Fallacy, which stands for "... but on a computer!"

Yes, complete with the ellipses and italics. There's a recurring pattern I've seen in technology prognostication best shown by example.

I surrender.

Many years ago, I set myself a simple task. I would create a blog layout for myself, and it would have some sort of color in it. It would not simply be a white background.

After all, the best way to learn something is to force yourself to do it, right?

Unfortunately, I failed. The resulting design could be charitably described as "quirky" and accurately described as "ugly". What's more, the design you may have seen was the best of at least a dozen or so attempts! It turns out I can take a very sensible and aesthetic design from a standard template site, and in three small changes, utterly destroy it.

The Definition Disclaimer

Human words are a great deal fuzzier than the concepts they hope to cover. For instance, consider the word "love"; it means anything from stalker-level obsession to a moderate preferance ("I love pizza!"). In order to talk about anything precisely it is often necessary to specify what a given word refers to in some specific context.

Every writer has the right to choose what definitions they are using in a particular bit of text. If they say that they have chosen a particular definition of "love", that is not a point that can be usefully debated. Definitions are neither right nor wrong. They are only useful or not useful. What can be debated is statement the word is used to make.