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…
Ruby 3.2.0 is from another dimension
291–300 of 341 posts
Re: Ruby 3.2.0 is from another dimension
#292Ruby 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.
Re: Ruby 3.2.0 is from another dimension
#293Just 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…
RubyVM::YJIT.enabled?
RubyVM::YJIT.runtime_stats
Re: Ruby 3.2.0 is from another dimension
#294This 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
you deserve more publicity, really lovely :)
Re: Ruby 3.2.0 is from another dimension
#295Ruby 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…
Re: Ruby 3.2.0 is from another dimension
#296Earlier 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…
Re: Ruby 3.2.0 is from another dimension
#297This whole thread consists of Python vs Ruby discussion. I abandoned both when .NET 5+ was released. C# on Linux makes me happiest.
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
#298Earlier 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.
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
#299Earlier 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…
> 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
#300Earlier 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…
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]