Unveiling the big leap in Ruby 3.3's IRB
railsatscale.com
railsatscale.com
With Prism, you can then create tool suites like syntax_tree [2], which then leads Prettier formatters [3], a new Ruby LSP [4], which unlocks a new Ruby LSP VS Code extension [5], not to mention a laundry list of other gems like Rubocop and of course Ruby itself that will benefit from a faster and more maintainable Ruby parser.
It's a beautiful illustration of the power of questioning conventions, going back to first principles to uncover better solutions to previously solved problems, whose new solutions create new capabilities which unlocks the ability to solve new problems.
[1]: https://github.com/ruby/prism [2]: https://github.com/ruby-syntax-tree/syntax_tree [3]: https://github.com/prettier/plugin-ruby [4]: https://github.com/Shopify/ruby-lsp [5]: https://marketplace.visualstudio.com/items?itemName=Shopify....
But indeed, the type completor would've been much harder to build and maintain if without Prism.
Really appreciate the attention to detail. I know little of ruby's internals, so usability flaws like those mentioned are difficult to put into google and try to fix (some usability hiccups are not due to bugs but due to misconfigurations - i.e. something I've set up incorrectly). These little quality of life improvements make a world of difference when using IRB for hours to get stuff done. Thank you to all those that make ruby awesome!
I edit directly inside my code and use tmux's send-to-pane to send my current line(s) to IRB. Ex: https://cln.sh/xXNlf51m
Far nicer to just execute the program and put a breakpoint at the cursor…
COLORS.each{ |c|
define_sheep_class(c)
}
sheep1 = Sheep::Bl|
This feels like the only way my editor stands a chance of completing this to Sheep::Black. Is this how Ruby IDE support works (e.g. in the JetBrains product.)Frankly I think not going further is a good thing in that it'll discourage people from going unnecessarily far with the dynamic features.
I wrote one, and while it's not yet complete I can say it's really _not that hard_
Bravo Ruby team!
One thing I can think of is multi line statements (on Byebug). Really annoying to test longer method chains. Would love a debugger that supports it out of the box, as the new irb seems to do.
At the time, to inspect what you could do with an instance, I wrote `my_thing.methods.sort - Object.new.methods.sort` many a time. It's great to see features making IRB even better after all these years.
it works for me on linux, not sure about other OS's. Although I'm now noticing that the article linked in the original post says that Ruby has a pure Ruby replacement for readline: Reline. So I wonder if it will not work with more recent versions of Ruby that use Reline?
I'm a fan of both languages.
Unless type annotations are treated like first class citizen in the language, it won't be good enough. My theory is that those in the community wanting static types went to Go or Rust.
A second point is IDE support. It is so hard to get started with ruby auto-format, code completion, ctrl-click to follow code and debug. Python is readily usable in pycharm community edition.
why do you think that?
Given just the syntax, I would always recommend Python as a first language to scientists in a lab, rather than ruby. The code just reads and writes itself better, without special characters.
But, I think it’s not fair to call Ruby gross, given some people love C++, php, bash, JavaScript… I’d take ruby over many languages, given a choice.
The much bigger elephant in the room is the semantics. My personal pet peeve is that Ruby, just like Perl or C, doesn't have any sort of file-based isolation. While importing something in Python normally doesn't mess up any namespace except for the stuff you've just imported, Ruby basically leaves this to programmers' and they create monstrosities where one require statement can do way too much magic to my liking. And while there are some libraries and frameworks that are closer to Python in spirit ("explicit is better than implicit"), Rails is something that really throws me off as most things just magically happen to work with some incantation that seemingly comes out of thin air.
This new autocomplete thing may be a real breakthrough for people who learn by getting their hands dirty and trying to write something, probing around the available methods and functions to find the appropriate one. If it can suggest what's possible/available, a lot of the magic may fade away and become proper, explainable hard science.
Just a personal opinion, of course.
Your team mates probably object to that ease of writing, as they did for Perl 20 years ago.
Not all languages are created equal and some were designed to be more conducive to maintable code for large teams of developers.
Ruby is not one of these languages.
Your conclusion is not supported by the claim you try to support it with.
> Ruby is not one of these languages.
You're free you think so, but you've not provided anything but unsupported conjecture and logically invalid reasoning to support your belief, so rather than convince me, you've provided an additional reason to question your judgement.
Rubyists introduced me to automated provisioning and deployment - Puppet, Chef, Capistrano - as well as concepts like test-driven-development and the genius of metaprogramming, but it’s common to hear javascripters waxing lyrical about TDD while slagging off Ruby.
Ruby is like 12-Bar Blues: people who love rock music don’t always like hearing blues. My favourite story is about seeing Earl Slick and Bernard Fowler performing Bowie, and they struck up a long bluesy intro which caused one of the two older fellas standing next to me at the bar to turn to me and say, “I really don’t like all this blues crap!” only for the “blues crap” to become The Jean Genie two seconds later.
Careful what threads you try and unravel as they may weave your own narrative…
And python that Ruby doesn’t have: :: for slices @ for decorators
And for the symbols that they both share, subjectively, a lot of them are used for often in Ruby.
Remember Python didn’t start with being fully object oriented, everything is not exactly an object, they bolted on the useful functional stuff later (like every language has now after a weird period of people crapping on FP for some reason) and to top it off bundler, and Ruby version manager again were just largely copied over to Python as pip and venv. I like both languages, and I say this after getting schooled a few times about great things I thought Python did that I was a few times rather embarrassingly shown to have just been Ruby ideas picked up by others.
I’ll give you the language looks a bit funny and I’m not saying it’s better or anything, I work in Ruby and am all too aware of the warts. Just trying to share what I’ve learned that they did well because it’s a good and thoughtful community.
Python’s venv is so much better than whatever Ruby has.
None of that is actually true, to the extent that it makes any sense (which it doesn't really). Python had a complete object system and first class functions pretty much from the first preview, and anonymous functions (lambda), map, filter, and reduce were added before 1.0 was cut. Which predates the first public preview of Ruby.
> to top it off bundler, and Ruby version manager again were just largely copied over to Python as pip and venv.
And that is complete nonsense, virtualenvs have nothing to do with rvm, and pip is in no way a copy of bundler (not that it's in any way exceptional, it's a package manager).
> I say this after getting schooled a few times about great things I thought Python did that I was a few times rather embarrassingly shown to have just been Ruby ideas picked up by others.
So after getting told you were spouting nonsense one way you went on to spout nonsense the other way?
Poetry gets very close through, but it took decades to get there and afaik it is still not viewed as an "official" part of the toolset.
If I cared more about the expressiveness and the speed of prototyping at the expense of everything else, I would rather use Ruby which has much more stuff built-in and I'd accept to pay the price of its runtime penalty.
But if I cared more about performance, I'll rather use a static language like Go or Rust.
If I have to pay the dynamic language performance & maintenance tax, it needs to be worth it and I need to get some big advantages in return, otherwise I'd just use Go.
In 18 years of Ruby use, this has been typical. E.g. I've done large scale (tens of thousands of layers) map tiles rendering in Ruby, and only a tiny core of the final rasterisation code was worth rewriting even back then at a time when Ruby was far slower.
Port sklearn to ruby, and people will use that..
Python is horrible in terms or exceptions, code conventions, etc.
See also http://ruby-data.org