[HN Gopher] News for Ruby 3.2.0 ___________________________________________________________________ News for Ruby 3.2.0 Author : type0 Score : 105 points Date : 2022-12-23 20:20 UTC (2 hours ago) (HTM) web link (docs.ruby-lang.org) (TXT) w3m dump (docs.ruby-lang.org) | mdhb wrote: | Quick question for the current Ruby community: | | I kind of moved away from Ruby right around the time Ractors were | about to land and they looked really promising. | | I was just curious if they ended up delivering much in the way of | change and if not what the main problems were? | Alifatisk wrote: | Ractors is still in experimental stage but I've played around | with it and it sure offers a huge performance benefit & true | concurrency | mdhb wrote: | I assume by the fact they are still experimental that there | isn't much in the way of adoption yet? | drchiu wrote: | I was looking into this question a few weeks ago and | couldn't find any libraries I would use in typical | applications (eg. background jobs, etc) implementing | Ractors. | | There are occasional comments in GH issues discussing the | possibility of implementing Ractors, but nothing material. | Lammy wrote: | Here's one that sounds like exactly the sort of example | you had in mind: https://github.com/okeeblow/DistorteD/tr | ee/NEW%E2%80%85SENSA... | | Disclaimer: mine :) | faebi wrote: | While on the topic, I still don't get it why we have [].last but | {}.last fails with a NoMethodError. | saghm wrote: | Are hashes guaranteed to be ordered in some way (not just | incidentally implemented that way, but specified so that | changing it in the future would be considered breaking)? I | thought they weren't, in which case there wouldn't really be | any obvious way to define `last`, but I might be mistaken | danielheath wrote: | Ruby hashes are ordered, per the docs. | sodapopcan wrote: | `{}.first` works, so no reason why `{}.last` shouldn't. I | would argue, though, that it's best not to rely on hashes for | ordering, though that's a relatively loose preference, and | I've certainly use it for quick 'n' dirty scriptss | latortuga wrote: | Ruby hashes have been intentionally ordered since Ruby 1.9, | which is ~15 years now. | BurningFrog wrote: | I agree that it's conceptually weird, but since Ruby | guarantees the ordering, you might as well have features | for it. | sodapopcan wrote: | Ya, it's one of things you have to make a team/org-level | call on. | | For me, ruby is full of a lot of little conveniences that | shouldn't necessarily be used in production systems. I | always cry loud that code should be quickly "scannable", | and the data-structures we choose to use can help a lot | in the quicker understanding an unfamiliar piece of code. | | But I stress again: these types of decisions are best | left up to the team or org. It's ultimately low-stakes. | Lammy wrote: | The best feature of `Hash` maintaining insertion order is | that `Set` does too, since a `Set` is a `Hash` with | all-`true` values: https://github.com/ruby/ruby/blob/3539 | da64fc42d6eb76f1d4c3cc... | Lammy wrote: | Since 1.9: https://bugs.ruby-lang.org/issues/994 | matsadler wrote: | Add support for bundle gem --ext=rust command. | | Cool to see support for writing extension gems in Rust shipping | with Ruby. | petersafwat wrote: | i love javascript | meisel wrote: | How do MJIT and YJIT differ? | jez wrote: | MJIT pastes together snippets of C code that implement Ruby VM | bytecode instructions. It then hands off that C code to GCC | which compiles it to native code while the Ruby VM is running. | | YJIT compiles from Ruby VM bytecode straight to native code | using a JIT technique called basic block versioning (which is | slightly different from how JITs like V8 work because the unit | of reuse is a basic block instead of a function). | | There's more information in these links: | | https://youtube.com/watch?v=zO9_uTaELCw&feature=shares | | https://shopify.engineering/yjit-just-in-time-compiler-cruby ___________________________________________________________________ (page generated 2022-12-23 23:00 UTC)