4 ms·
One trend that I notice is that most new languages focus their design on writability over readability. And by writability I mean prioritizing features that allo
by ceronman 5y ago
One trend that I notice is that most new languages focus their design on writability over readability. And by writability I mean prioritizing features that allow you to express more, while typing less code. These languages are specially prone to become "brown languages".
One classic example is Perl. One of the killer aspects of Perl is that it allowed you to write in just one line or two what in other languages would take dozens of lines and boiler plate. Writing Perl is actually really nice. You could go from idea to working code extremely fast. And that's why Perl became super popular two decades ago. However, maintaining a 100K LoC Perl website written by a lot of different people over 20 years, it's definitely not a nice experience.
I know this is going to upset a lot of people, but another extreme example is Lisp. I think I've never seen any language as expressive as Lisp. Once you grasp it, writing Lisp is really really nice. However, reading a complex Lisp program using a ton of macros and a lot of higher order functions could be really hard. In my experience some of the hardest code to read that I have ever encountered has been written in Lisp. And if reading is hard, I don't even want to talk about debugging. But okay, Lisp never really became super popular, so let's ignore it for now.
One more modern example: Kotlin. Kotlin's main improvements over Java are mostly on writability. Semantically, these languages are very similar. That's kind of intentional, as one of the goals of Kotlin is maintaining a very good interoperability with Java. However, Kotlin is nicer to write than Java. Java is verbose, Kotlin is succinct. Kotlin adds a lot of syntax and features to make you write the same things that you would express in Java but in a much shorter way. Writing Kotlin is so much nicer than writing Java, I'm sure of that.
I recently started working on a large Kotlin code base, and I can say that reading Kotlin is harder than reading Java. It turns out that verbosity is not a problem when actually reading code. And having few ways of expressing things actually makes code easier to read.
Languages with a lot of features and different ways of doing things are easily abused. You can still write readable code in them, but it requires a lot more discipline. It's so tempting to use that obscure language feature to make your code so succinct!
Python is a language that always put emphasis on readability. The developers of the language are famous for rejecting a lot of ideas to be added to the language. Even though Python is almost as old as Perl, so far, it has escaped from becoming a brown language and it's still loved. Who knows if it will remain like that.
Another language that seems very serious about this is Go. I know that there are a lot of Go haters here on HN, but you have to admit that Go designers put more emphasis on readability than writability. I predict that Go will escape from becoming a brown language.