Catenary

Screenshot of Catenary

Well, it took a while but today I'm proud to release Catenary, a concatenative programming library for Javascript.

When I first saw Forth and Factor I didn't really think much of them. Mostly I messed around a few times, figured out that doing arithmetic was super tough and then got bored. It was only later on that I began to realise the elegance of making a language with so little in it. That elegance ended up prompting me to start messing around with what eventually became Catenary.

Although it took several rewrites to get there, I'm fairly chuffed that there ended up being only 76 lines of code in the core. On the way I managed to throw out nearly every concept I started with, and in fact part of what took a long time was getting stuck because I threw out one too many and had to go back. So I'm fairly confident there's not much left to trim. Along the way I ended up learning a lot of significant stuff about why concatenative languages are the way they are, and which particular concepts are unnecessary sugar and which are actually fundamental.

I'm not sure if concatenative-programming-in-the-large will ever hit the mainstream, but I think that, like functional programming, it can supply a really interesting framework to structure your ideas around. Catenary was designed in that spirit - it's meant to supplement traditional Javascript, not replace it. If you can go in and out of concatenative style at will, maybe the result will be that certain problems begin to look much easier.

If this project managed to make people think about concatenative patterns in regular code the way they do about functional ones, that would really be something amazing.

Metaconsent

I was talking with some people at dinner a little while ago about the ethics of killing animals for food. It's a question I've always found fascinating because I think that at some point, our technological means will make it unnecessary. Shortly after that it will become morally questionable. And shortly after that, barbaric and embarrassing. It's right at the nexus of a lot of interesting moral questions that we don't have good answers to: What is the value of life? How do we allocate moral weight to beings? And, my favourite, what is life anyway?

I find the non-commutativity of life particularly interesting. Creating a life is not as good as taking a life is bad. So if you can either have no children at all, or have two children but kill one of them, the former is ethically fine and the latter is deeply wrong. However, the net result of the first decision is one less person than would have existed with the second decision.

If you could go back in time and convince someone not to have children, and those children cease to exist in the present, have you murdered them? What if you cut out the time travel and just convince someone to not have children today? If you could choose for the entire human race to just stop reproducing tomorrow, meaning the complete eradication of our species in the next hundred years, would that be ethically superior to, say, the one-off genocide of a billion people? But what is that if not bigger numbers plugged into the same moral equation?

The relevance to animals is of course that there are so many animals that are alive because we keep them for meat. Perhaps it is barbaric that we breed and slaughter them. But what about all those lives that would never have existed otherwise? Are they really worth nothing? If you could choose to live for twenty years or no years at all, what would you choose?

I'm struck by the pig that wants to be eaten from Hitchhiker's Guide. It feels so weird because it takes two important values – individual choice and protection from harm – and rams them into each other. What do you do with someone who wants to be harmed? Our current, fairly un-nuanced answer is that someone who wants to be harmed doesn't really want to be harmed and actually has a mental illness. But there's a large subculture of people who enjoy being recreationally harmed without needing any psychiatric treatment at all! To say nothing of extreme sports, daredeviling and other high-chance-of-maiming activities.

I think to address at least some of these questions it would be helpful to have a notion of metaconsent. That is, perhaps there is no ethical issue eating an animal that wants to be eaten, but there is an issue creating that animal. It can consent to being eaten, but it can't metaconsent to wanting to be eaten. The decision to have those values was forced on it. It is equivalent to someone who hypnotises you into desperately wanting to eat tree bark. After the deed is done, that same person would be doing you a favour by feeding you all their extra tree bark. However, they still did you a grievous wrong by making you want it in the frist place: they violated your metaconsent.

The thorny question is how you could possibly obtain metaconsent from a being that doesn't exist. Obviously, we have not metaconsented to the desires we have or the things we value, they just happened to us. The universe is not a moral being, however, and as we take the ability to create life from nature we also take the responsibility to do better. One option would be to try to imagine a discussion with a version of the being that has a neutral position on the subject. An animal that doesn't feel strongly about being eaten or not eaten would still prefer not to *want* to be eaten, because being eaten also interferes with most other goals.

However, for many things it would be more complex. Either a neutral position might not be meaningful (what's a neutral food preference?), or tautological (would you rather want short or long socks, assuming you have no current feelings about them?). The latter case could be an indicator that metaconsent would be granted – I certainly wouldn't be dismayed to learn that I've been genetically predestined to prefer short socks – but there are some decisions where saying "see, no preference!" could be hiding a more serious problem. Maybe you could construct a hypothetical animal with no preferences of any kind. Why would it care, then, about whether it wants to be eaten or not?

I think a secondary option would be a metaconsensual form of the categorical imperative, or the veil of ignorance: if the position might also apply to you, would you metaconsent to it? It's pretty tough to justify creating an animal that wants to be eaten if you can't imagine ever metaconsenting to wanting to be eaten.

To bring it back around, then, we can use the same techniques to have a hypothetical discussion with the cows that we breed. Would they want to be brought into existence? By the first test, I think yes; if a cow takes a neutral position on being born and then eaten, then any other desires (enjoying grass and so on) would push it into wanting to exist. The second criteria is a little trickier. You could imagine an equivalent situation where humans are subjugated by some kind of evil aliens who kill us and eat us sometimes. Would we collectively rather have a lot fewer people in exchange for no more killing and eating? I think each individual person would rather exist, but maybe collectively we would agree that the improvement in dignity is worth the lost lives.

I don't know if it's very satisfying to finish with a maybe, but I think that this way of thinking at least provides an entry point to reasoning about the morality of bringing beings into existence or changing what they value. I'm certainly a lot less impressed with the animals-are-better-off-being-eaten argument, at least.

Hold-to-confirm

glasses $39.99

(The above is actually clickable - try it!)

This is an idea I had today while I was buying stuff on eBay and enduring the interminable 12-click process you have to go through: Yes, I want to buy it. Yes, I confirm I want to buy it. Yes, I want to pay for it. Yes, I want to pay for it with PayPal... and so on. I assume it's to stop you buying stuff by accident, but it's still a bit ridiculous.

Google have, for a long time, been fighting the good fight against confirmation screens. Their philosophy is to ask for forgiveness rather than confirmation. Yep, you just accidentally pressed that button and deleted your email. Did you want it back? Okay, just hit undo. All better.

Two problems with that: firstly, not every transaction is undo-able. Spending money, for example, is a lot of hassle to undo. The other problem is that it's still frustrating when the computer does something you don't want, even if you get an undo button. I can't count the number of times I've accidentally deleted emails on my phone while trying to scroll. That frustration doesn't undo either.

So here's an interesting way to look at it: just make the button a bit harder to click. I'm okay with waiting a couple seconds if I don't have to navigate to any more screens, confirm anything else or hit undo. I creatively called it hold-to-confirm. If you want to take a look at the source there's a cleaner version on GitHub.

VRoom

vroom!

I was hunting through my Code directory and I found this neat demo I made last year for a WebRTC hack day. It's called VRoom and it's an experiment with audio spatialization and environmental effects. It uses a PannerNode in HRTF mode to pan the sound and apply extra processing to make it sound more directional.

There are maybe a few cleverer ways to do environmental effects. Hard Mode would be to actually do full audio raytracing, but that's probably overkill for most things. Instead, I think it might be sufficient to just use two ConvolverNodes; one based on a distance query to cover reflective noises (like echoes on concrete) and one based on an intersection query to cover refractive noises (replacing the current distance-scaling effect).

It's pretty crazy when you think about just how much there is in the Web Audio API. And all the new web APIs for that matter. There's not much difference between the web and a complete OS anymore.

Projects page

I've just added a projects page to the site.

Although everything in there is, at the moment, pulled straight from my posts here, I'm quite pleased about having a separate place to just list things I've done. I should be filling it out more soon with other past projects, assuming I can actually still get them to run well enough to generate screenshots.

I'm also considering adding an equivalent page for ideas, but that seems like it could get out of hand very quickly.