Blog

The Future of Programming is Text

You can't grep or diff binary trees. You can't get a Smalltalk IDE on your iPad. You can't write an operating system or a big application in Scratch or the Mindstorms IDE. And even a small program in these won't work in the next version.

But you can edit plain text with any text editor, whether that's ed, nano, Vim, emacs, BBEdit, Atom, Textastic, Editorial, Eclipse, AppCode, whatever. You can save it safely and easily in any source control system. You can run an awk or sed script over your entire codebase and it just works.

See also:

If your language (or non-linguistic programming environment in some cases) is only usable from a single IDE, you've cut yourself off from every other analysis and editing tool in the world, you're dependent on that one tool to do everything you want.

I have old Mac and iPhone NIB files which can't be read with any current version of Xcode/Interface Builder, the file format was only supported by one dev tool and it's changed, and the old tools don't run on modern OS X. These NIB files "work", in that they deserialize into objects, but there's no way to edit them. Where possible, I now do most UI work in code; this isn't great fun, I end up with a ton of builder functions to avoid repetitive code blocks, but it'll still compile and work in 10 years.

This is also why I don't use a WYSIWYG word processor, I use MultiMarkdown. I've lost documents to proprietary WPs, and of course there's no way to run tools over them (except, sort of, MS Word with BASIC).

None of this has stopped people from making new non-text environments, or weird experiments. Experiments can be useful even when they fail, telling us what doesn't work. But they don't catch on because the tools aren't as good as text, and won't work in the future when the experimenter gets bored and quits.

Scary Things on Netflix

  • Mindhunter is fantastic, David Fincher-produced '70s period piece serial killer interviews. They made a show just for me!
  • Slasher was so tedious and badly paced I couldn't make it to a second episode. Will try again later, after the first few people are dead.
  • Curse of Chucky, Cult of Chucky: Child's Play keeps on going. When Don Mancini wrote the original, a Teddy Ruxpin/Cabbage Patch Kid/My Buddy gone rogue was impossible but creepy. Now we're on the verge of making robots that can do this. The movies are still fun trash, but don't you ever let a talking redheaded doll in your house or insane asylum, it'll kill you.
  • Patton Oswalt opens his comedy special with shit about Twitter and politics. Nope nope nope. I closed my Twitter for a reason.

Capsule Silence XXIV

So speaking of Anamanaguchi, the new albums are part of a "game" you can get on their site, and it is fantastic. Easily the best game since E.T., the PDF in the app download (Windows & Mac in one zip file! Cats & frogs living together!) has a "17 stages of Joseph Cambell's MONOMYTH" slide which must be placed in all future slide decks, and Larold's story is so compelling it would make Hemingway cry. I found all the tapes for the rack + 3 extra, which shows the attention to detail in this game.

Science Fiction & Saturday Music

  • Humble Bundle Adventures in Science Fiction Books: Runs until Oct18, and everything in this that I've read (Anderson, Bear, Brunner, Ellison, Foster, Silverberg, Steele, Sterling, Swanwick) is excellent, and I'm enjoying Sergei Lukyanenko's1 The Genome enormously. They've picked what looks like an all-good-stuff collection.

Saturday Music is a little spacey.


  1. I adore the Night Watch books; but because of what they say, or because they're bound up in memories of rainy nights in Seattle reading at all-night cafés and public transit, very like the Moskva of the books? The first movie is great, but only about half the first book; the sequel movies are dire, some of the worst hatchet-jobs of adaptations I've ever seen. 

Swiftian Satire, or Tragedy?

I honestly cannot tell if Swift developers are seriously eating Irish babies, or taking the Mickey.

From bad implementations of Equatable and Hashable, the wag leaps to:

extension GridPoint : HashVisitable {
    func hash<H: Hasher>(_ hasher: inout H) {
        self.x.hash(&hasher)
        self.y.hash(&hasher)
    }
}

Bravo! That's easily the funniest punchline to a programming joke since "where do you think the chaos came from?"

Starts with the most bizarre strawman Objective-C Sieve of Erathosthenes I've ever seen. A real implementation would be in C, because Obj-C is C with objects, and it'd be massively faster:

#include <stdlib.h>
#include <stdio.h>

typedef char BOOL; // or link in Foundation
#define YES 1
#define NO 0

int main(int argc, char **argv) {
    if (argc != 2) {
        printf("Usage: primes COUNT\n");
        exit(1);
    }
    long n = atoi(argv[1]);
    BOOL p[n];
    p[0] = NO;
    p[1] = NO;
    for (long i = 2; i < n; ++i) {
        p[i] = YES;
    }
    for (long i = 2; i < n; ++i) {
        for (long j = i*i; j < n; j += i) {
            p[j] = NO;
        }
    }
    for (long i = 1; i < n; ++i) {
        if (p[i]) {
            printf("%ld ", i);
        }
    }
    puts("");
    return 0;
}

This does use more lines of code, but they're short, low-density, and it's instantly obvious what it's doing (my predilection for 1-char var names aside). Can you actually decode his filter-based version?

func sieve(_ sorted: [Int]) -> [Int] {
    guard !sorted.isEmpty else { return [] }
    let (head, tail) = (sorted[0], sorted[1..<sorted.count])
    return [head] + sieve(tail.filter { $0 % head > 0 })
}

let numbers = Array(2...1000000)
let primes = sieve(numbers)
print(primes)

And the runtime experiment:

mdh@Aegura:~/Code/CodeC% time clang -O3 -o primes primes.c                
clang -O3 -o primes primes.c  0.04s user 0.41s system 83% cpu 0.534 total
mdh@Aegura:~/Code/CodeC% time ./primes 1000000 >~/Desktop/primes.txt      
./primes 1000000 > ~/Desktop/primes.txt  0.02s user 0.00s system 89% cpu 0.025 total

mdh@Aegura:~/Code/CodeSwift% time swiftc -O -o swiftPrimes swiftPrimes.swift
swiftc -O -o swiftPrimes swiftPrimes.swift  0.57s user 0.64s system 69% cpu 1.754 total
mdh@Aegura:~/Code/CodeSwift% time ./swiftPrimes >~/Desktop/swiftPrimes.txt  
./swiftPrimes > ~/Desktop/swiftPrimes.txt  51.79s user 26.49s system 99% cpu 1:18.78 total

So the naïve C implementation is about 3,151x faster. I can't measure it precisely because a limit measurable in C, would take Swift until the heat death of the Universe.

So here's my question: Is Vincent aware of this, and his theme of "diabetes", "sugar", "saccharine", etc. pointing at how fat, bloated, slow, and deadly Swift is? He never lets on if this is a joke, he keeps tossing more syntax layers on top of Swift.

AIM-less

AIM is being shut down and the Kids Today™ are sad. LiveJournal was driven under by Facebook, then bought by Russians and murdered for being gay. ICQ is still going, but nobody uses it. I miss USENET 🙁 . Blogs & blogrings were killed by Twitter but some of us are posting again.