Live data from Hacker News

Ruby 3.2.0 is from another dimension

tomaszs2.medium.com

291–300 of 341 posts

Re: Ruby 3.2.0 is from another dimension

#291

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…

Been through it before, when I used ColdFusion. Not highly regarded these days, but among the options at the time, it was ridiculously fast to build applications in. To this day, even has some features missing in other languages/frameworks. However, things shift in the industry. In CF's case, it was the shift to open source and package managers, IMO. There's no value in casting stones at the use cases that undermine your worldview. (Personally I love Ruby, but if and when the time comes, I'll move on to whatever meets the needs of my employer/client)

Re: Ruby 3.2.0 is from another dimension

#292
post #213

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 love Ruby. Sinatra was actually my entry into using Ruby and recently have been working on a side project with Rails 7. I work with PHP and Laravel too and after working with Rails 7 for a bit Laravel is like a cheap imitation. I also work with python a lot and I wouldn't want to do the web work in python as much as I would ruby but I would rather do the data crunching in python.

I love Ruby, and a substantial amount of our application is written in Ruby. However, there's a very significant portion that requires NodeJS, and to write it in Ruby would be an absolute ball of mud of kludginess and abstraction. I'm happy to write code in a time when I have great tools I can piece together appropriately to make great solutions.

Re: Ruby 3.2.0 is from another dimension

#293

Just some anecdata but I'm not seeing such dramatic improvements with YJIT, actually in my limited testing it's much slower... Ruby 3.2.0, on a M1 MacBook Pro hitting a simple healthcheck route in a production Rails 6.1 app with wrk (`wrk -c8 -t8 -d30s http://localhost:3000/healthcheck `): - 423 reqs/second with JIT disabled (using 229MB of RAM) - 74 reqs/second running with `RUBYOPT="--yjit"` (using 385 MB of RAM) I…

did u check to see ruby is with YJIT enabled?

RubyVM::YJIT.enabled?

RubyVM::YJIT.runtime_stats

Re: Ruby 3.2.0 is from another dimension

#294
post #13

This https://github.com/ruby/ruby/pull/5407 is how to run Ruby with WASI.

While the original Wasm PR description is a useful historical snapshot of the cross-build instructions, the copy in the official documentation is being updated over time: https://github.com/ruby/ruby/blob/master/wasm/README.md

https://www.youtube.com/@tom.stuart/streams this is so fun to watch you!

you deserve more publicity, really lovely :)

Re: Ruby 3.2.0 is from another dimension

#295

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…

when I was mostly doing ruby, with the occasional foray into python, I would have agreed with you. but having gotten a python day job and using it as my primary language for the past several years, I think there are features that python got right and ruby did not, as well as vice versa of course. the top one is the way the two languages handle modules and namespaces (ruby lets you reopen modules, which is nice, but python lets you easily see at the call site whether you are calling a function from an imported file, which is amazing for large projects), but I also miss introspectable doc strings, and syntactic support for type annotations (which are also introspectable at runtime!) when I'm writing ruby these days.

Re: Ruby 3.2.0 is from another dimension

#296
post #157

Earlier quoted context omitted.

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…

> As for your Ruby examples: I think you could argue that the filter_map version is very readable, but not necessarily more so, but the select one looks pretty painful. The select does two passes, which makes it quite inefficient. One does not even need filter_map, since the example is essentially a reduce operation. res = (1..10).reduce([]) { |a, x| x != 5 ? a.push(x**2) : a } This works in ruby 2.5.1. Probably work…

you can define pretty much everything as a reduce operation though

Re: Ruby 3.2.0 is from another dimension

#297

This whole thread consists of Python vs Ruby discussion. I abandoned both when .NET 5+ was released. C# on Linux makes me happiest.

how many jobs are using .net + c# on linux, and not some enterprises legacy software?

where i live, Germany, is java .net and 99% are enterprises old managers with old software :(

Re: Ruby 3.2.0 is from another dimension

#298
post #269

Earlier quoted context omitted.

> To be fair though, my vim-memory of using % to bounce between start/end brackets doesn't work in Ruby because of the begin/end words instead of matched symbols :( Put "runtime macros/matchit.vim" into your .vimrc. Or for even better support add the matchup plugin. https://github.com/andymass/vim-matchup

I'm not a vim user, but I think the problem with Ruby here is that it's not begin/end. It's anything that evaluates to an iterable/end.

Yes, that's the problem for plain vi(m) which only supports single character braces.

matchit/matchup extends this to language specific delimiter words. This animation https://github.com/andymass/vim-matchup#screenshot shows how you can iterate over multiple sequences like if/elsif/else/endif.

Re: Ruby 3.2.0 is from another dimension

#299

Earlier quoted context omitted.

> By who? By the Python developers and its wider community. As Python doesn't have anonymous function blocks in the same way as Ruby (only lambda expressions), tutorials, lessons and the Python docs steer users toward list comprehensions instead. I'm not saying the ruby syntax is not elegant (it is), I'm saying in Python list comprehensions are recommended over filter/map functions. On the composable front, personall…

You're effectively saying something like: Canadians prefer Canada. What about the rest of the world? Once you start adding more "and" to the if-statement in the list comprehension, it becomes a mess. Breaking them down to smaller chunks is required because comprehensions are messy. You are doing smaller chunks due to a shortcoming of comprehensions. Chaining is nice option to have, especially when the chained functio…

> Map/filter are considered inferior in Python to list comprehensions.

> By who?

> By the Python developers and its wider community.

> You're effectively saying something like: Canadians prefer Canada. What about the rest of the world?

They're actually saying that Python developers prefer one particular way of doing something rather than a different particular way of doing the same thing. You're suggesting that they're saying Python developers (Canadians) prefer Python (Canada).

I don't mean to speak against your broader points, just that this specific call out is mistaken.

Re: Ruby 3.2.0 is from another dimension

#300
post #52

Earlier quoted context omitted.

One aspect in which Ruby is much more consistent than Python: sorted(arr) arr.sort() versus arr.sort arr.sort!

I'm definitely a Python person, having used both fairly significantly - Python about ~12y, Ruby ~3y. One thing I think Ruby gets right is the naming convention for methods that modify the object they're called on ( . !) and callables in general that return a boolean ( ?). My biggest gripe with Ruby is the class implementation. I find metaclasses a bit more difficult to understand in Ruby. I hate that I can't easy det…

> I hate that I can't easy determine where a given method of an arbitrary object is defined.

https://tenderlovemaking.com/2016/02/05/i-am-a-puts-debugger...

The relevant bit is under the heading:

> I’m calling a method, but I don’t know where it goes

  def index
    p method(:render).source_location
    render params[:id]
  end
It sounds like this is the answer to your monkey-patching woes.

  my_object.method(:my_method).source_location # returns /path/to/file.rb:[line number]
Post reply on HN