Superintelligence CouncilСовет гения · sim.im

DHH · 2025-07-12 · source ↗ · whole document (17)

Beautiful code

`0:51:15`

Ruby boils almost all of it away. We start with the if. Okay, that's the same. No parenthesis necessary because there's no ambiguity for the human to distinguish that the next part is just a single statement. So you do if, space, user, dot, admin, question mark. No open brackets, no parentheses, no nothing. Next, open line. Here's your conditional. That question mark means nothing to the computer, but it meets something to the human. Ruby put in the predicate method style purely as a communication tool between humans. It's actually more work for the interpreter to be able to see that this question mark is there. Why is this question mark in here? Because it just reads so nicely. If user.admin?

`0:52:15`

That's a very human phrase, but it gets better. You can turn this around. You can have your statement you want to execute before the conditional. You can do user.upgrade. Say you're calling an upgrade method on a user. Space, if, space, user.admin?. We do the thing if the thing is true. Instead of saying, if the thing is true, do the thing. But it gets even better. This is why I love this example with the conditional, because you can keep diving into it. So let's flip it around. user.downgrade if!not user.admin, right? That'd be a typical way of writing it. Ruby goes, that exclamation point is light noise. Why do we have if and then an exclamation point, that's ugly. We could do user.downgrade unless user.admin?

`0:53:17`

That to me is an encapsulation of the incredible beauty that Ruby affords the programmer through ambiguity that is only to serve the human reader and writer. All of these statements we've just discussed, they're the same for the computer. It'll combine down to the same C code. That'll compile down to the same assembly code. It makes no difference whatsoever. In fact, it just makes it harder to write an interpreter. But for the human who gets to choose whether the statement comes before the conditional or the predicate method has, it's just incredible. It reads like poetry at some point. — It's also incredible that, you know, one language designer's creating that, you know, Guido van Rossum also, it's like one person gets to make these extremely difficult decision because you have to think about how does that all get parsed? And you have to think about the thousands, if it's a popular language that millions of people that end up using this.

`0:54:17`

And what they feel, what that question mark for the if statement, what does that feel like for the user? — That's what Matz thought about because he started his entire mission off a different premise than almost every programming language designer that I'd heard, at least articulate the vision. That his number one goal was programmer happiness. That his number one goal was the affordances that would allow programmers to articulate code in ways that not just execute it correctly, but were a joy to write and were a joy to read. And that vision is based on a fundamentally different view of humanity. There's no greater contrast between Matz and James Gosling, the designer of Java. I wanted to listen to James talk about the design of Java. Why was it the way it was? Why was it so rigid? And he was very blunt about it, which, by the way, I really appreciate. And I think Gosling has done a tremendous job with Java.

`0:55:20`

But his view of humanity is rather dark. His view of humanity was programmers at the average are stupid creatures. They cannot be trusted, which sophisticated programming languages because they're gonna shoot their foot off or their handoff. And that would be kind of inconvenient to the regional development office of a mid-tier insurance company writing code that has to last for 20 years. Now it's actually a very Thomas-Sowell view of constrained capacity in humans that I've come to appreciate much later in life. But it's also a very depressing view of programmers that there are just certain programmers who are too dumb to appreciate code poetry. There are too ignorant to learn how to write it well. We need to give them a sandbox where they just won't hurt themselves too much. Matz went the completely opposite direction.