←back to thread

111 points teleforce | 2 comments | | HN request time: 0s | source
Show context
usrbinenv ◴[] No.43800544[source]
I constantly feel like inferior languages are picked up, while superior languages are discarded. It's almost as if the universe had a law: "inferior technology is always preferred no matter how hard you seethe".

Examples:

  * Python preferred over Ruby
  * TypeScript preferred over Dart or even JavaScript (which is fine and, as a bonus, doesn't require compilation step like TS)
  * Go is preferred over Crystal and D.
While Python, TypeScript and Go are quite alright, there is no doubt in my mind that their alternatives are absolutely superior as languages. Yes, in case of Dart, Crystal and D the ecosystem doesn't have the abundance of well-tested libraries, but as languages they are simply better. The Go argument that it's popular because it's simpler is absurd in the sense that no one really forces you to write complex code and use classes or other advanced OOP features in D.
replies(10): >>43800688 #>>43800728 #>>43800902 #>>43801262 #>>43801977 #>>43802028 #>>43802144 #>>43802418 #>>43804822 #>>43804929 #
Demiurge ◴[] No.43800902[source]
> Python preferred over Ruby

... Perhaps what you're describing is having a niche opinion. If you had some opinions, like a preference for "Everything must be done in as many ways as possible with funky characters" or "I hate indentation", it would certainly seem that the world is against you. But, perhaps, you just really smart and can remember the intention of all the complicated code you wrote a year ago, so you don't even need to write comments, and thats great. However, being special does not mean that some technolgoy is objectively inferior, unless you can actually come up with a provably objective metric.

Overall, the technology that is there, solving most of the problems for most of the cases is the technology that is superior, by the law of the universe, not the other way around.

I don't agree with any of your examples, but I have my own, like Pascal is a better language than C, by many metrics. I can also accept that C, is what people who invented unix, also invented. And that makes Pascal inferior to C, now, as choice for any project that requires that you hire embedded software developers. That's what the universe decided.

replies(1): >>43801112 #
kouteiheika ◴[] No.43801112[source]
> "Everything must be done in as many ways as possible with funky characters"

Are you sure you're not talking about Perl here? Because there are very few "funky characters" in Ruby and code written in it tends to be very readable, more so than Python in many cases.

I agree with OP. While Python is not a bad language, Ruby is a better language in general, and I'm reminded of it every time I have to work in Python (which is pretty often nowadays, due to Python's dominance in ML ).

I can give many examples as to why, but here's a quick toy example to show off the difference in philosophy between Ruby and Python. You have a list of numbers, you want to keep only odd numbers, sort them, and convert them to a string where each number is separated by comma. Here's the Ruby code:

    xs = [12, 3, 5, 8, 7, 10, 1, 4]
    ys = xs.filter { |x| x.odd? }.sort.join(", ")
Now let's do the same in Python:

    xs = [12, 3, 5, 8, 7, 10, 1, 4]
    ys = [x for x in xs if x % 2 != 0]
    ys.sort()
    ys = ", ".join(str(y) for y in ys)
Or alternatively in a single line (but in more complex cases this gets extremely unwieldy since, unlike Ruby, Python forces you to nest these, so you can't write nice pipelines that read top-to-bottom and left-to-right):

    xs = [12, 3, 5, 8, 7, 10, 1, 4]
    ys = ", ".join(str(y) for y in sorted(x for x in xs if x % 2 != 0))
And this matches my experience pretty well. Things I can do in Ruby in one line usually take two or three lines in Python, are more awkward to write and are less readable.
replies(3): >>43801386 #>>43802023 #>>43804096 #
abenga ◴[] No.43801386[source]
To a beginner who is used to ordinary imperative languages, that Ruby line is extremely difficult to understand. Is `.filter` a method or a property of `xs`? Is `{ |x| x.odd? }` an argument to a method or just a statement that comes after `xs.filter`? If it is passed to `.filter`, why does it not have parentheses around it but the `", "` passed to `join` does?

This all makes sense to a person who knows the language a lot, but wrinkles the brain of a newcomer. Too many concepts to juggle in order to understand. On the other hand, the Python one reads quite easily, even if you may have to go right to left.

replies(3): >>43801536 #>>43801707 #>>43802058 #
1. kouteiheika ◴[] No.43801707[source]
> To a beginner who is used to ordinary imperative languages, that Ruby line is extremely difficult to understand.

I don't understand this argument. You are a beginner only for a tiny fraction of your time using a given programming language. Why are we optimizing a programming language for people who don't know it, instead of optimizing it for people who actually program in it?

replies(1): >>43802327 #
2. abenga ◴[] No.43802327[source]
> Why are we optimizing a programming language for people who don't know it, instead of optimizing it for people who actually program in it?

Everyone who actually programs in a language was once a person who didn't know it. Languages which optimize for succinct terseness might be powerful once you master them, but they will never enter mainstream use, which I guess is not necessarily the aim.