Live data from Hacker News

Ruby 3.2.0 is from another dimension

tomaszs2.medium.com

141–150 of 341 posts

Re: Ruby 3.2.0 is from another dimension

#142

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…

Does Ruby still not allow type annotations in the same file as your code? Last time I checked, you had to put them in separate .rbs files. That’s a dealbreaker for me

Re: Ruby 3.2.0 is from another dimension

#143

Earlier quoted context omitted.

In what situation is python the worst possible choice, while ruby which is very similar to it is the best possible choice? Unless you're doing some clever ruby metaprogramming type stuff which is totally impossible in python.

> In what situation is python the worst possible choice, while ruby which is very similar to it is the best possible choice? in no particular order, on top of my mind (there are many more): - mixed environments when you can't compartmentalize Python in a container. Python package management is one of the best examples of "poor implementation" - mixed environments, when both Python 2.x and 3.x are present. Migration t…

I think this could be summed up as a) python venvs can be very annoying, and are a weakness of python, and b) rails + active record is a strength for ruby. Fully agree with both, but disagree with the hyperbole (worst possible choice vs. best possible choice). FWIW I haven't even seen Python 2 code in about 6 years.

Re: Ruby 3.2.0 is from another dimension

#144
post #128

Earlier quoted context omitted.

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.

And Rails back then was extremely slow. There have always been web frameworks for Ruby with way less overhead.

Re: Ruby 3.2.0 is from another dimension

#145
post #129

Earlier quoted context omitted.

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 t…

One funny anecdote (and unfair one) is that what Twitter wasn't able to do (rails scale), Mastodon did.

I recall several discussions of it at the time, and I don't think it's so much that they weren't able to, as that they'd made lots of disastrous architecture decisions (building it around a monolithic database etc.) that required a rewrite, and whomever doing it used it as an opportunity to blame it on Rails as an excuse to switch to their preferred stack.

After all, sharding message distribution via federation (even if you hide the federation behind a veneer of a global userid -> shard mapping) was a well understood long before Twitter even launched (e-mail... reflectors...), so it was a rather embarrassing architectural decision to not even try to account for it. Heck, I co-founded a webmail provider in '99, and one of the first things we did was implement ways to map user ids to a distributed set of backends and support for migrating accounts between backends, because we knew it'd be necessary to be able to shard smtp servers, frontends, and storage separately. That wasn't in Ruby, but the architectural pattern is so obvious.

The language change may or may not have made sense for them at the time (after all Ruby was much slower then, and they by then had the size where a rewrite of core parts to cut hosting costs might have been worth it), but that they blamed their architectural failures on Rails was a cheap shot.

Re: Ruby 3.2.0 is from another dimension

#146
post #131
post #112

Do these YJIT improvements come at the cost of significantly increased memory usage?

Yes, like all JITs by definition. The actual memory increase depends heavily on the app size so I could quote some figures but it would likely be irrelevant to you.

No, that is not per definition. While the JITing uses memory a JIT can remove unnecessary allocations from the JITed code and in theory reduce memory usage. But in practice you should expect higher memory use.

Re: Ruby 3.2.0 is from another dimension

#147

Earlier quoted context omitted.

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…

The Python one looks fine to me, although I am a Pythonish person. It uses what people already know: the for something in somethings syntax of the for loop, and the if syntax. Also it's nice that this works in dictionaries, generators and lists. It also has the same narrative flow of Haskell's list comprehensions, which I think come from set theory: [x^2 | x As for your Ruby examples: I think you could argue that the…

[deleted]

Re: Ruby 3.2.0 is from another dimension

#148

Earlier quoted context omitted.

I disagree. I perceive no difference in elegance between the two languages nor a particular “cobbled together” aspect to Python.

Meta classes, dict/slot are some really inelegant stuff.

I disagree. They are elegant.

Re: Ruby 3.2.0 is from another dimension

#149

Earlier quoted context omitted.

I disagree. Ruby has no more elegance or consistency than the other popular language, and it objectively has a much poorer selection of libraries.

Lack of libraries is noticeable - especially since I've worked with python for past years. However Ruby's syntax is way nicer. I can actually write what I think instead of having to translate my thoughts into python. Of course over time working with python has made my thoughts to conform into more pythonic way, but I still occasionally find myself thinking how something would have been way nicer to write in ruby inst…

I disagree. Ruby’s syntax is not nicer.

Re: Ruby 3.2.0 is from another dimension

#150
post #37

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…

> Maybe like blockchain, once the AI/ML fantasy hype dies down Two minutes of silence for the poor sods who still thinks that AI/ML is pure hype. (Granted, there is hype. But there is much real stuff.) And, also, blockchain and ML/AI are nothing similar, except for Twitter bottom-feeders trying to milk each. AI/ML already has real applications with hundreds of millions of dollars actual value created. And just like C…

>AI/ML already has real applications with hundreds of millions of dollars actual value created.

Hundreds of billions a year probably (and that may be low) if you count online advertising and large consumer facing sites in general. If you turned off the ML behind Facebook/Google/Netflix/Amazon then you'd be lucky to only lose 50% revenue based on my personal experience of adding ML on top of such products.

Post reply on HN