Hacker News new | ask | show | jobs
by DrBazza 1463 days ago
Just because Rust, in particular, compiles successfully, that's no guarantee that the code isn't complex and difficult to understand. I can write a complex badly designed app in any language. Similarly I can write simple well designed large applications in any language too.
2 comments

Yeah, but that doesn’t mean all languages are created equal in that department. Let’s take this pseudocode:

    int a = 0;
    if (findindex(mylist, myvalue, &a)) { 
        // dostuff with a
    }
Here, findindex returns false if it can’t find the value. The problem is that there’s nothing forcing you to use the if, you can just forget it and you’ll be left with incorrect code. In Rust, this type of error is impossible to make by accident, because the findindex function would return an Option, and you have to explicitly handle both cases (or explicitly say you don’t care about one of the cases).

Things like that, along with the lifetime system, make it easier to write good code. It’s like saying that it’s possible to destroy your foot with a shotgun and with a pencil – it’s possible, but it’s a lot easier do to by accident with the shotgun.

This fallacy gets repeated over and over again and it doesn't make it any less false.

Languages are tools and some tools are actually better-built than others. If we can claim that a language like Brainfuck makes writing clear code extremely difficult, and Python or Rust make writing clear code easier, we've already established that there's a spectrum for language in expressiveness and clarity.

Eliminating entire classes of bugs makes for better understanding.