Earlier quoted context omitted.
Map/filter are considered inferior in Python to list comprehensions. res = [x**2 for x in range(10) if x != 5]
Before Ruby introduced filter_map: res = (1..10).select { |x| x != 5 }.map { |x| x ** 2 } With filter_map: res = (1..10).filter_map { |x| x ** 2 if x != 5 } In both cases, I think the Ruby solution is more readable. Python list comprehensions invert the subject (data) and the verb (action). You see what will be done before you see what the subject is. I would argue that showing the subject first allows easier code re…
Ruby 3.2.0 is from another dimension
301–310 of 341 posts
Re: Ruby 3.2.0 is from another dimension
#302Earlier quoted context omitted.
I don't know about corporate adoption. I started programming around 2008 or so, and the first things I encountered outside of grad school were Ruby and Python. At first I used Ruby because I felt like anything I wrote "just worked", but later I switched to Python because there was just "one way to do things", and also because of NumPy/SciPy/Jupyter.
The thing is, the “one way” is not at all true now. Maybe it was then. Today’s landscape is better but also very different. And when looking up how to do certain things in Python, Stackoverflow will show you a multitude of options. The problem for me is that I dislike most of them.
Agreed. It was a smaller language then, but it's never been as expressive as Ruby.
Re: Ruby 3.2.0 is from another dimension
#303Earlier quoted context omitted.
When I looked at Python vs Ruby many years ago, I found the opposite: Why does Python have (special) functions like len() and map(), instead of 'properly' supporting both OOP (len should just be a method on objects) and/or FP (support multi-line lambdas so I can actually use map/filter etc). I never understood how this can be considered consistent at all, and those IMHO language design warts made me look into Ruby at…
Map/filter are considered inferior in Python to list comprehensions. res = [x**2 for x in range(10) if x != 5]
I also think that map and filter style computations can be much more powerful, there are quite a few things other than just map and filter, like count, take, skip, find, flatten, fold, map-while and quite a few more!
In python I guess you are supposed to use a standard for loop to do these things instead.
Re: Ruby 3.2.0 is from another dimension
#304Earlier quoted context omitted.
If this comment is indicative of the general attitude of the Ruby / RoR community then I can’t exactly say that I’m jumping up and down to get involved. I feel like I’ve been transported 10-15 years back in time with this ridiculous negativity. Django and RoR are much of a muchness. Ruby and Python are too, to a lesser extent. This whole thing stinks of narcissism of small differences and sour grapes. To imply that e…
I refer to The Blub Paradox - http://www.paulgraham.com/avg.html I have used both languages extensively, off and on for nearly 20 years. I've also used C, C++, Java, and built some small projects with Clojure and Elixir. Of course people have differing sensibilities when it comes to aesthetics, but at a certain point equally observed options can be compared - with one being recognized as better. I don't put down Pyth…
After using languages with no statements, going back feels like a pointless restriction in expressiveness. You don't even need a ternary operator when blocks are expressions that can be used for assigning to variables.
Re: Ruby 3.2.0 is from another dimension
#305Earlier quoted context omitted.
I had over million euro of machinery stop because a rarely reached branch had one line with one less space due to missing linter run. Apparently Python 3 still doesn't fully parse and validate code on load, or somehow it made a valid if nonsense AST out of that.
I know it's offtopic, but this is really a case of using spaces where tabs are the correct choice ;)
Re: Ruby 3.2.0 is from another dimension
#306Earlier quoted context omitted.
> It's slower than Ruby That’s like saying that Dodge Neon is Slower than Mazda Miata. Both are bottom of the barrel compared to any compiled language.
A Miata will smoke a Neon in the corners and is just more pleasant to drive. Miatas are the number one hobby motorsport (racing) vehicles of choice for a reason. Which is actually a great analogy for Ruby vs Python!
I know. :^)
Both are shit compared to better cars, though.
Re: Ruby 3.2.0 is from another dimension
#307I added the syntax error detection in 3.2. I hope it’s helpful!
Re: Ruby 3.2.0 is from another dimension
#308Perhaps the official release info is of more interest. This blog post is quite 'inspired' by it. It does mention the source but I do not see the added value of the blog post over the official release info: https://www.ruby-lang.org/en/news/2022/12/25/ruby-3-2-0-rele...
Agreed. The author is surprised by a major Ruby release on Christmas day (tradition for many years) and uses a lot of superlatives for no reason.
Re: Ruby 3.2.0 is from another dimension
#309Earlier quoted context omitted.
> one that lacks the elegance and consistency but which has a larger ecosystem. ... and decent first party docs, actual code modules rather than “execute every source file in the global namespace”, a first party Windows build, etc., etc., etc. If the Ruby community can't acknowledge the real things holding it back compared to other available options, well, that makes it that much harder to catch up.
They did apparently manage to make their interpreter figure out where mismatched "end" statements are most likely to be, which was one several serious pain points for me with the language. I don't think the execution model you mention, which results in the absurdity of C style transitive includes polluting the global namespace, will ever be changed though.
This suprises me. I've missed `end`s before as much as anyone, but I guess as an OCD reformatter (prettier, IntelliJ, rubocop, etc.), they show up VERY OBVIOUSLY and right quick. They've never even been an itch, much less "pain".
Re: Ruby 3.2.0 is from another dimension
#310Earlier quoted context omitted.
One aspect in which Ruby is much more consistent than Python: sorted(arr) arr.sort() versus arr.sort arr.sort!
Personally I think the Python syntax make its more explicit which is an in-place sort vs returning a sorted copy. And also what's a method call vs an attribute access. Someone new to Ruby will be WTF is the ! for?
To me, the ! and ? syntax in Rugby is genius. It is a language wide self documenting tool to explain a dangerous function and a boolean, which make total sense.