27 ms·
Ruby 3.4.0
- evjan 2y ago‘it’ is a welcome addition!
- ciconia 2y agoDon't say that word! https://www.youtube.com/watch?v=RZvsGdJP3ng https://www.youtube.com/watch?v=RZvsGdJP3ng
- ilvez 2y agoTruly is, much nicer than that lonely `_1`
- rubyfan 2y ago_2 can be as bad as _1
- BoingBoomTschak 2y agoI'd have thought allowing _ as a synonym for _1 would have been more aesthetically consistent. That's the path I went with when designing my CL #λ reader macro, personally.
- JasserInicide 2y agoI don't understand the point of it when the `.map(&:upcase)` syntax is shorter. This just seems like yet another syntactic sugar Rubyism that doesn't really add anything. If it's an alternative to the `|x|` syntax when using only one block variable, then I like that.
- graypegg 2y agoThat only works when calling a method on the things you’re iterating thru, it is a replacement for the single variable block example you gave there
- Trasmatta 2y ago`arr.map { it.thing.blah.stuff }` The `&:` doesn't work in that context
- ilvez 2y agoNot to point any fingers, but shows that the previous commenter have not struggled with this :) &: is very nice, but not enough.
- zachrose 2y agoDoes `it` conflict with Rspec's `it`? Surely they've thought of this, but to my eye it looks like it would get confusing.
- prh8 2y agoNope it doesn’t, they did take that into account during development.
- omoikane 2y agoI am most excited about the parser change, previously discussed here: https://news.ycombinator.com/item?id=36310130 https://news.ycombinator.com/item?id=36310130 - Rewriting the Ruby parser (2023-06-13, 176 comments) I remember being taught to use yacc in our compiler course because "writing it by hand is too hard". But looks like Ruby joins the growing list of languages that have hand-written parsers, apparently working with generated parsers turned out to be even harder in the long run. That said, replacing a ~16k line parse.y[1] with a 22k line prism.c[2] is a pretty bold move. [1] https://github.com/ruby/ruby/blob/master/parse.y https://github.com/ruby/ruby/blob/master/parse.y [2] https://github.com/ruby/prism/blob/main/src/prism.c https://github.com/ruby/prism/blob/main/src/prism.c
- PittleyDunkin 2y agoI'm pretty sure the only reason people ever used parser generators is that it allows a language that vaguely resembles the formal description of the target language. I always found them very confusing to write, confusing to debug, and much less efficient than writing your own. It's actually pretty straightforward once you get the tokenization and lookahead working.
- pests 2y agoAgreed. Parser generators are a magic black box. Parsing is not too difficult, there is some actual computer science in some spots, but I think parsing should be a core complacency of a programming language to unlock full potential.
- capitol_ 2y agoA very very long list of CVEs disagrees with that parsers are "not too difficult".
- supriyo-biswas 2y agoBinary format parsing != Programming language parsing.
- ciconia 2y agoRuby is getting more and more awesome these last few years, especially when it comes to performance. Since 3.3 I've been running all my apps with --yjit, it makes a tremendous difference!
- Alifatisk 2y agoWait until you hear about TruffleRuby
- phoronixrly 2y agoThanks, but no thanks. Never touching anything by oracle.
- Alifatisk 2y agoNo wait, I know Oracle has a bad rep which is deserved, but TruffleRuby and GraalVM is truly open-source, not open-core. They actually did something great this time. Someone pointed this out https://news.ycombinator.com/item?id=42323293 https://news.ycombinator.com/item?id=42323293
- tekknolagi 2y agoGraalVM tends toward open core. They have entire test suites and test tools that are internal-only that make developing it kind of difficult.
- phoronixrly 2y ago> You will need to sign the Oracle Contributor Agreement (using an online form) for us to able to review and merge your work. Read my lips: N. O. Read the CLA. This is a trap, do not get yourself or your company caught in it. It is open-source for now, until it gets enough traction. Then the rug will be pulled, the code will be relicensed as well as any further development or contributions. This is insane, I cannot believe anyone can read and understand this and not consider the abuses of power it allows: > 2. With respect to any worldwide copyrights, or copyright applications and registrations, in your contribution: > ... > you agree that each of us can do all things in relation to your contribution as if each of us were the sole owners, and if one of us makes a derivative work of your contribution, the one who makes the derivative work (or has it made) will be the sole owner of that derivative work; > you agree that you will not assert any moral rights in your contribution against us, our licensees or transferees; > you agree that we may register a copyright in your contribution and exercise all ownership rights associated with it; and > you agree that neither of us has any duty to consult with, obtain the consent of, pay or render an accounting to the other for any use or distribution of your contribution. I would go as far as to state that anyone who contributes any code to this works against open source (by helping out an obvious rugpull/embrace-extend-extinguish scheme that diverts adoption and contribution from cruby/jruby) and against their fellow developers (by working for free for Oracle).
- shortrounddev2 2y agoWhat does ruby do well that other languages don't? What is the niche it's trying to fill?
- cyberpunk 2y agoIt’s a general purpose language with some very mature frameworks. I don’t think it needs a niche. :)
- speleding 2y agoIt's the language with the highest ratio of (useful work / LOC), so it's the least verbose language. This makes it very suitable to write and understand complex scripts, because the reduced boilerplate means less cognitive overhead for the programmer. As a result, experienced programmers can be extremely productive with it. The well-known Rails framework uses this to great effect, however, some people argue that the choice of "convention over configuration" and extensive use of meta-programming, derisively called "magic", make it less suitable for inexperienced teams because they get too much rope to hang themselves and the lack of explicitness starts working against you if you're not careful.
- continuational 2y agoExperienced teams love magic?
- dochne 2y agoExperienced teams know to be careful and sparing with its use.
- psychoslave 2y agoIt depends which kind of magic. Everybody love some magic to be in its life, as long as it doesn't reveal to be a curse unintentionally coming out from a good willing wish. Also you don't want all and everything being the results of spells you don't have a clue how they are cast.
- 2y ago
- tuananh 2y agoShopify strategy aka the story of YJIT If I cannot refactor my services, I shall refactor Ruby instead.
- FBISurveillance 2y agoSince when contributing back to the community is considered a bad faith move?
- t-writescode 2y agoThat's certainly not what I get out of what they said. Shopify has introduced a bunch of very nice improvements to the usability of the Ruby language and their introductions have been seen in a very positive light. Also, I'm pretty sure both Shopify for Ruby and Facebook for their custom PHP stuff are both considered good moves.
- pjmlp 2y agoThat has been the story of every dynamic language since forever, thankfully the whole AI focus has made JITs finally matter in CPython world as well. Personally I have learnt this lesson back in 2000's, in the age of AOLServer, Vignette, and our own Safelayer product. All based on Apache, IIS and Tcl. We were early adopters of .NET, when it was only available to MSFT Partners and never again, using scripting languages without compilers, for full blown applications. Those learnings are the foundations of OutSystems, same ideas, built with a powerful runtime, with the hindsight of our experiences.
- sonudfgh 2y ago[dead]
- rapind 2y ago> Personally I have learnt this lesson back in 2000's, in the age of AOLServer, Vignette, and our own Safelayer product. All based on Apache, IIS and Tcl. Woah, your mention of “Vignette” just brought back a flood of memories I think my subconscious may have blocked out to save my sanity.
- thdhhghgbhy 2y agoWhy did NodeJS take off on the backend while Rails was still popular? I'll never understand it.
- zarzavat 2y agoGoogle hired all the best JIT engineers and set them to work on v8. If you want better performance you'd have to choose an AOT compiled language.
- Lio 2y agoThat seems like a meme from 10 years ago. I don’t think that’s really true anymore is it? I mean Truffle Ruby is as fast as V8 already and MRI yJIT and jRuby are catching up fast. It could also be argued that JVM is the gold standard JIT. I think that shows that Google doesn’t have a monopoly on great JIT engineers.
- masklinn 2y ago> I mean Truffle Ruby is as fast as V8 already v8 and node are 15 years old. That's when this actually mattered and js on the backend took off.
- attractivechaos 2y ago> Truffle Ruby is as fast as V8 already and MRI yJIT and jRuby are catching up fast According to which benchmark? At my hand [1], node is ~60% faster than TruffleRuby and over an order of magnitude faster than yjit v3.3.0. [1] https://github.com/attractivechaos/plb2?tab=readme-ov-file#appendix-timing-on-apple-m1-macbook-pro https://github.com/attractivechaos/plb2?tab=readme-ov-file#a...
- neonsunset 2y agoOpenJDK HotSpot and .NET RyuJIT both produce much faster code :) And the latter lets you operate on the same level of abstraction as Rust and C++ compilers do.
- dragonwriter 2y agoAlready outdated: https://www.ruby-lang.org/en/news/2024/12/25/ruby-3-4-1-released/ https://www.ruby-lang.org/en/news/2024/12/25/ruby-3-4-1-rele...
- t-writescode 2y ago[flagged]
- Kwpolska 2y agoChristmas Day is a traditional Ruby release day: https://en.wikipedia.org/wiki/History_of_Ruby#Table_of_versions https://en.wikipedia.org/wiki/History_of_Ruby#Table_of_versi...
- t-writescode 2y agoCertainly! I bet it was part of a sort of "this is my Christmas present to all" sort of thing; and, as happens sometimes, little mistakes, like the need for the quick bugfix happen :)
- mtkd 2y agoI had just hit this issue (3.4.0 showing as 3.4.0dev in rbenv) and am having a coffee before looking at what is going on -- thanks for posting
- cannibalXxx 2y ago[flagged]
- coldtrait 2y agoI'm up. A beginner enthusiast in ruby.
- bantunes 2y agoDo you have any evidence that it's been used less and less?
- jstummbillig 2y agohttps://trends.google.com/trends/explore?date=all&q=%2Fm%2F06ff5&hl=en https://trends.google.com/trends/explore?date=all&q=%2Fm%2F0...
- ilvez 2y agoGlad to see Estonia being number 4 in that list. We have some nice successful businesses built on Ruby.
- workfromspace 2y agoSame. Dropping this related list here: https://ruby.ee/members/ https://ruby.ee/members/ (This list is incomplete; you can help by expanding it :)
- rsanheim 2y agothis is evidence of google searches. nothing more.
- dudisubekti 2y agoThere's also the TIOBE index: https://www.tiobe.com/tiobe-index/ruby/ https://www.tiobe.com/tiobe-index/ruby/ It conveys similar trend to Google Search chart
- pjmlp 2y agoI am liking all the performance improvement goodies on JIT and GC level.
- ksec 2y ago1. Wondering 3.4 JIT performance vs 3.3 JIT on production rails. 2. Also wondering what upside could Ruby / Rails gain on a hypothetical Java Generational ZGC like GC? Or if current GC is even a bottleneck anywhere in most Rails applications.
- pjmlp 2y agoMost likely not yet there, but for applications implemented in Ruby it is certainly an improvement for overall usability experience.
- neonsunset 2y ago> Also wondering what upside could Ruby / Rails gain on a hypothetical Java Generational ZGC like GC? Or if current GC is even a bottleneck anywhere in most Rails applications. Ruby's GC needs are likely to be very far from the needs of JVM and .NET languages, so I expect it to be both much simpler but also relatively sufficient for the time being. Default Ruby implementation uses GIL so the resulting allocation behavior is likely to be nowhere near the saturation of throughput of a competent GC design. Also, if you pay attention to the notes discussing the optimizations implemented in Ruby 3.4, you'll see that such JIT design is effectively in its infancy - V8, RyuJIT (and its predecessors) and OpenJDK's HotSpot did all this as a bare minimum more than 10 years ago. This is a welcome change for the Ruby ecosystem itself I guess but it's not going to change the performance ladder.
- vidarh 2y agoThere's TruffleRuby (built on Graal) and JRuby if you want to explore that. They're not viable for everything, but they can be much faster.
- viraptor 2y agoI would expect some measurable improvement given how object-happy rails programming is. It's not uncommon to see 3 layers of models just wrapping a single variable - "objects that could've been functions". Some kind of tiers like generations or per-request pools would be amazing.
- fithisux 2y agoCongratulations guys. Thank you for the hard work.
- 0xferruccio 2y agoAlways looking forward to the Christmas tradition of Ruby releases
- saghm 2y agoYears back I took over the ownership of the third-party Arch Linux package for ruby-build because the maintainer at the time wasn't using it anymore and was looking to pass it off. At the time, I had no idea that Ruby did released every Christmas, but I found out a few months later when I got an email mentioning the package was out of date that day. Even though I haven't done much Ruby dev for years now, it's been a small little tradition of mine since then to update the package first thing every Christmas morning and push out the update (basically, just updating the version number in a file in a git repo and then running a couple commands to update the checksums and push the changes; nothing anywhere close to the amount of work that people who actually develop that tool do, let alone the people who work on the language!). I can't help but feel like that farmer from the meme saying "it ain't much, but it's honest work"; I enjoyed the little tradition I've built up and like thinking that maybe every now and then someone might have noticed and been pleased to get the updates without having to file a notice to remind me to update things (although it's happened a few times since that time years ago, I hope it hasn't been that often!). Just now, I was surprised to see that the package seems to be getting put into the official Arch repos, so my eight years of very minimal volunteer service seem to be at an end. I still think I'm going to remember doing this and smile a little every Christmas morning for years to come!
- uticus 2y agoThank you for the quiet work, appreciated
- tan-z-tan 2y agoEvery year-end, I update my Rails app. Lately, it's been stable, and the updates just improve performance, so it's gotten easier.
- tbolt 2y agoI haven’t worked in ruby or rails in a few years but both seem like they’re in great spots and I’ll be spinning up a new project with Rails 8 soon. Hype
- tan-z-tan 2y agoSounds good. Rails is still my first choice for personal development (though I've been using Next.js more often recently).
- Gigachad 2y agoI started at a company 3 years ago that was on Rails 5.1. After 3 years on and off work I've managed to get it to Rails 6.1. The process is such an incredible nightmare on a large app. Currently stuck on trying to get Ruby 3 working.
- prh8 2y agoSame thing for me—4 years ago, Rails 4.2. Now on 6.0, work for 6.1 is wrapped up. I did just finish going from Ruby 2.7 to 3.3. Any particular issues you’re having, or just working through the process?
- Gigachad 2y agoDon’t have the exact details on me but it was just the change for the method params hash thing. The stack trace seems to be pointing places that aren’t the source of the issue, just where it got triggered in some dynamic way. Probably just need to spend more time understanding exactly what changed and how to convert stuff.
- ljm 2y ago
- cssanchez 2y agoI want to try Ruby since the news of Rails 8 came out, but it's been so difficult that I just gave up. Installing Ruby on Mac and Windows and actually getting the 3.3 version required for Rails 8 was a huge mission and test of patience because every installer defaulted to older versions of both Ruby and Rails even one month after the release. And yes, even Docker required tweaking to get the versions and I had issues with devContainers anyway... I finally got it installed and then followed some tutorials only to see that Rails' html.erb files have completely broken syntax highlighting in VSCode and other editors. I facepalmed and though I tried to search for a fix online, I couldn't find one. I saw posts mentioning it in forums and yet not a single solution posted. So I gave up. I tried in Mac, Windows and Linux. If someone here knows how to fix the broken highlighter, that can be my Christmas gift today, but for the most part I've moved on.
- bendangelo 2y agoUse rvm to install ruby. Ruby dev sucks on Windows, mac only.
- koshersalt 2y agoI think this is a major reason Ruby had trouble taking off compared to Python. Most desktops were Windows, especially for businesses.
- liprais 2y agotypical hn comments,ignoring elephant in the room.
- TiredOfLife 2y agoRuby and rvm sucks also on linux (at least on SteamDeck).
- jstummbillig 2y agoWhat sucks about it?
- hackerbrother 2y ago(Removed)
- baggy_trough 2y agoNeither of those is the case.
- deleted 2y ago[deleted]
- tklank 2y ago[flagged]
- revskill 2y agoHope ruby 4 had static type system like typescript.
- matthuggins 2y agoI would love that!
- revskill 2y agoDHH is the issue, he means Rails is for one-person framework while he think static typing is only for enterprisey software.
- dismalaf 2y agoDHH has no say in Ruby development. That being said, Matz also isn't a fan of static typing. Static type annotations exist in the form of RBS, but no one that matters in the Ruby eco-system is pushing static type annotations in .rb files themselves. Also, after seeing TypeScript, I'm very happy about that.
- nona 2y agohttps://github.com/soutaro/rbs-inline https://github.com/soutaro/rbs-inline I myself am unsure where I stand on RBS. I wouldn't mind more use of it in my gem dependencies, but would probably not like it if it was enforced everywhere. For now I'll stick with improving my test/spec-writing skills, and maybe some runtime type checking like https://literal.fun/ https://literal.fun/
- dismalaf 2y agoI think RBS is a decent tool, I don't mind it as long as it never becomes a requirement for anything. I hate the trend of statically typed dynamic languages because it's all of the pain without the main benefit (native speed).
- 2y ago
- replwoacause 2y agoIf I want to make a SSR site using Ruby, are there any good frontend UI libraries that make doing this easier? It’d be nice if there was some Ruby abstraction for writing HTML, CSS, and JS that makes building interactive UIs easier (possibly built on top of HTMX, AlpineJS, etc).
- Lio 2y agoDo you mean like Hotwire? https://hotwire.io/ https://hotwire.io/
- replwoacause 2y agoYes that is quite close to what I had in mind, thanks
- e12e 2y agoYou might want to look at view components: https://viewcomponent.org/ https://viewcomponent.org/ https://evilmartians.com/chronicles/viewcomponent-in-the-wild-building-modern-rails-frontends https://evilmartians.com/chronicles/viewcomponent-in-the-wil... https://thoughtbot.com/blog/hotwire-turbo-streaming-viewcomponents https://thoughtbot.com/blog/hotwire-turbo-streaming-viewcomp...
- replwoacause 2y agoVery intriguing, thanks for sharing this.
- nonconstant 2y agoAlso, you can check out the list of UI libraries for Hotwire https://hotwire.io/ecosystem/ui-frameworks https://hotwire.io/ecosystem/ui-frameworks
- replwoacause 2y agoThank you! This is exactly what I was looking for.