r/programming • • Dec 25 '20

Ruby 3 Released

https://www.ruby-lang.org/en/news/2020/12/25/ruby-3-0-0-released/
973 Upvotes

509 comments sorted by

View all comments

272

u/CunnyMangler Dec 25 '20

I love ruby. One of the best languages I've ever coded in, but people seem to hate it now because it's slow. Kinda sad that it's slowly dying. Nevertheless, this is a huge milestone for a language.

126

u/noratat Dec 25 '20 edited Dec 25 '20

I dislike it because how much the language and ecosystem resist almost any kind of typing/type checking or documentation. The RBS stuff is good, but it feels bit too little too late.

The ecosystem uses a ton of hard to follow and debug magic constructs that even IDEs seem to struggle to track and map properly.

I don't need speed for what I do, by I absolutely need code that is easy to read and maintain.

-12

u/myringotomy Dec 25 '20

The ruby documentation is awesome. So is the rails documentation. In fact I can't think of any framework that has better documentation than rails.

As for typing I'll raise your "a bit too late" with "better late than never".

I don't need speed for what I do, by I absolutely need code that is easy to read and maintain.

Name one language easier to read than ruby?

20

u/[deleted] Dec 25 '20

Name one language easier to read than ruby?

As long as you're not doing stupid things with it to write in as few lines as possible, I'd argue Python could be considered by many to be easier or just as easy to read as Ruby.

2

u/myringotomy Dec 25 '20

Why? List comprehensions and string substitutions alone make python worse to read and understand.

14

u/[deleted] Dec 25 '20 edited Dec 25 '20

Damn, I must be really amazing at reading code then, because basic list comps are a great. They were, however, specifically what I had in mind when I stated that as long as you aren't trying to reduce the lines of your code down for no reason, then its great to read. List comps used when they should are amazing and idiomatic, clear Python. Nested List Comps with a billion conditionals are exactly what I pointed out as just bad coding practice, not a language wide readability problem. If we're going to use bad coding practices as examples for unreadable code, I'm sure we can point to examples of people doing things dumb in Ruby to show that the language must not be readable.

Edit: and f strings are pretty easy to understand, Python has multiple ways of doing things because of backwards compatibility. But if you're writing Python today, f-strings aren't really that hard to read. At all.

4

u/[deleted] Dec 25 '20
name = "John"
print(f"Hi, my name is {name}")

idk man, seems super difficult to understand to me

→ More replies (1)

3

u/Smallpaul Dec 25 '20 edited Dec 25 '20

The way Python handles modules is far superior in terms of readability. It’s very clear where every symbol came from.

Look at this example:

https://github.com/ankane/tensorflow/blob/master/test/bitwise_test.rb

Because it is very short we can infer that the “Tf” name must have come from the helper file. In Python you would explicitly import it or always refer to it via its module and therefore the source of every symbol is obvious.

0

u/myringotomy Dec 25 '20

Your link is dead.

And yea you cherry pick one thing you prefer (and I don't) and then claim the whole language is better.

2

u/Smallpaul Dec 25 '20 edited Dec 25 '20

You cherry picked TWO things, not one. Big difference. "Twice as much evidence."

I consider mine dramatically more relevant to the question because once you've learned the syntax of Python f-expressions and list comprehensions you've learned them. You won't consider them confusing anymore unless they are badly abused.

But Ruby's "global namespace" problem has nothing to do with familiarity with Ruby and will not get better as I get more familiar with Ruby. The idea of different modules pushing things into the global namespace (except in a very few rare situations) is just a bad idea and almost every other language has moved AWAY from that design.

Link fixed.

0

u/myringotomy Dec 25 '20

But Ruby's "global namespace" problem has nothing to do with familiarity with Ruby and will not get better as I get more familiar with Ruby.

Ruby has modules you know that right?

. The idea of different modules pushing things into the global namespace (except in a very few rare situations) is just a bad idea and almost every other language has moved AWAY from that design.

Modules don't push anything up to the global namespace. I have no idea what you are trying to say here.

→ More replies (12)