Live data from Hacker News

Ruby 3.2.0 is from another dimension

tomaszs2.medium.com

121–130 of 341 posts

Re: Ruby 3.2.0 is from another dimension

#121

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…

> I think the Ruby solution is more readable.

I disagree and I’ve used both professionally for about the same amount of code.

Re: Ruby 3.2.0 is from another dimension

#122
post #59

Ruby is my favorite language, and often it is a joy to use because of its combined attributes of brevity, expressive power, and feature consistency. It's disappointing that there are so many more jobs for another popular language - one that lacks the elegance and consistency but which has a larger ecosystem. As far as I know, the only well known reason for a company to choose Ruby is if they want Rails (and obviously…

I'm sorry, I agree it is a beautiful language. But Ruby is slow. Performance matters. In a world when everything seems to run in cloud servers, efficiency matters. If you can have 20 times more simultaneous users in the same cloud server by using a different tech stack, there's no reason to keep using Ruby. For the record, I also think Python is generally slow, but it has improved in the latest version, and the impor…

If anything, the popularity of the major cloud providers is evidence that efficiency in the sense of computing power per dollar matters very little to most, as their pricing is extortionate.

Re: Ruby 3.2.0 is from another dimension

#123
post #117
post #42

Earlier quoted context omitted.

> reason for a company to choose Ruby is if they want Rails And that there, is the whole "Problem" of Ruby. Ruby is a beauty. Rails isn't. It's nice, productive (for certain niches) and has a long track-record. But Rails is also often the root of problems such as maintainability, long-term-productiveness, hosting (performance, scaling), and lock-in. There are far better solutions for simple CRUD-apps today than writi…

I've used Ruby since 2005, and I've disliked Rails pretty much from day one, and really wish the two were not so intertwined. At the same time I've used Ruby professionally almost as long while only rarely needing to touch Rails so I disagree it loses its usefulness though Rails fading from popularity certainly has an effect.

I did not mean that Ruby isn't useful without Rails.

But I do see the fading popularity of Rails (and therefore) Ruby to start affecting its usefulness. Less libraries, fewer bindings, abandoned libs and fewer hosting options.

Re: Ruby 3.2.0 is from another dimension

#124

Earlier quoted context omitted.

> it does have different meanings too the meaning is the same high level: it has side effects, being it a destructive update, an in place operation or throwing an exception. > `sorted` is a general function that gives you a sorted list from any iterable iterable in Python is a very loose concept though. And it's not very consistent too sorted("gheliabciou") ['a', 'b', 'c', 'e', 'g', 'h', 'i', 'i', 'l', 'o', 'u'] you…

You can use emoji in HN comments? Emojis get automatically removed from mine. Edit: ok, some do and some don’t. 🈶 is allowed but :laugh_with_tears: isn’t. I guess there’s a specific list of emojis that are getting stripped.

There are specific blocks that are filtered out.

Re: Ruby 3.2.0 is from another dimension

#125

Earlier quoted context omitted.

> it does have different meanings too the meaning is the same high level: it has side effects, being it a destructive update, an in place operation or throwing an exception. > `sorted` is a general function that gives you a sorted list from any iterable iterable in Python is a very loose concept though. And it's not very consistent too sorted("gheliabciou") ['a', 'b', 'c', 'e', 'g', 'h', 'i', 'i', 'l', 'o', 'u'] you…

You can use emoji in HN comments? Emojis get automatically removed from mine. Edit: ok, some do and some don’t. 🈶 is allowed but :laugh_with_tears: isn’t. I guess there’s a specific list of emojis that are getting stripped.

for reference ;)

https://news.ycombinator.com/item?id=19482991

Re: Ruby 3.2.0 is from another dimension

#126

About the regex speedup, it looks like Ruby 3.2 is now doing this https://swtch.com/~rsc/regexp/regexp1.html

Yeah, now i can confidently use this to check a string is float def is_float?(fl) fl =~ /(^(\d+)(\.)?(\d+)?)|(^(\d+)?(\.)(\d+))/ end

What does that pattern match that the following simplification doesn't?

    /(^(\d+)(\.)?(\d+)?)|(^(\.)(\d+))/

Re: Ruby 3.2.0 is from another dimension

#127

Earlier quoted context omitted.

So, how do you reconcile this opinion with the fact that Ruby can't even do a proper REPL on Windows? It just starts showing weird output, overwriting lines and doubling up other ones... that other language just works. And look, I LOVE Ruby. I come from twentyish years of Perl, and I really like the way Ruby feels when banging out a script but these days, time is in short supply, and I just don't have time to screw a…

If anyone reading this is thinking “why does Windows even matter for development?” then congratulations because you’ve discovered you’re in a filter bubble. Surveys, such as StackOverflow’s ( https://survey.stackoverflow.co/2022/#section-most-popular-t... ) consistently find that > Windows is the most popular operating system for developers, across both personal and professional use. If it makes anyone feel better, I…

I’ve only seen people program on windows or Macs professionally. Lots of HN people talk about developing on Linux desktop but I’ve never had a good experience with my hardware. Wether it’s an old MacBook Pro or a custom built PC, something like Bluetooth, WiFi, Ethernet, display issues, or the track pad just doesn’t work right.

I guess company laptops that run Linux have been vetted a little more.

Re: Ruby 3.2.0 is from another dimension

#128
post #59

Earlier quoted context omitted.

I'm sorry, I agree it is a beautiful language. But Ruby is slow. Performance matters. In a world when everything seems to run in cloud servers, efficiency matters. If you can have 20 times more simultaneous users in the same cloud server by using a different tech stack, there's no reason to keep using Ruby. For the record, I also think Python is generally slow, but it has improved in the latest version, and the impor…

I guarantee the language is not the limiting factor in a web scaling problem.

Not in the vast majority of practical use-cases anyway.

There'll obviously always be the exceptions like Twitter having to migrate off Ruby (Well rails) because scaling is just too hard. But those are exceptions.

Re: Ruby 3.2.0 is from another dimension

#129

Earlier quoted context omitted.

> ruby today is pretty fast Ruby today is slow as hell, but not as much as slower than other slow as hell languages as Ruby used to be.

did you benchmark Jruby or TruffleRuby? Did you compile c-ruby with jemalloc? Normally the "ruby is slow" argument, is based on not being involved with ruby and solving real problems with it. Some people will just LOL this argument even harder if you add development time and code maintenance costs on that equation.

Also premature optimisation. I did image manipulation and statistical analysis of images using predominantly Ruby for my MSc thesis work 15 years ago, and it took rewriting a couple of dozen lines of code with RubyInline (to use C) to remove the bottlenecks. Using pure Ruby to prototype and rewriting just the maths heavy code to C when I knew it worked and knew where the bottlenecks were saved me massive amounts of time. I've done map rendering in Ruby for similar reasons - outside of specific niches, it's rare for the speed of Ruby to be an issue.

Re: Ruby 3.2.0 is from another dimension

#130

Earlier quoted context omitted.

> I have been using Python since (at most) 2002. So 4 years after Google. Which made my point to the parent. And apparently everyone's been living under a rock because Python didn't become truly huge until maybe 10 years ago.

I did not start using python because it was adopted by Google. It was / is useful with or without Google.

You may not have, but let's not pretend it didn't become mainstream in the 2005-2020 time period...

When people decided what language to use, it was very much a "X uses this, maybe we should" kind of decision. Still is for the most part.

Post reply on HN