Ruby 3.5 Feature: Namespace on read

https://news.ycombinator.com/rss Hits: 6
Summary

While I believe namespaces would be a good addition to Ruby, I'm not convinced this particular implementation of namespaces is what Ruby needs. First, I'm not convinced by the motivations: Avoiding name conflicts between libraries: Applications can require two different libraries safely which use the same module name. Is this a problem that happens on a regular basis? I believe Ruby has a pretty well established convention for libraries to expose a single module with a name that correspond to their gem name. Actual top level module name clashes are extremely rare in my experience. Avoiding unexpected globally shared modules/objects Here again, from my experience this is very rare, and usually accepted as a bug, and promptly fixed. Do we have concrete cases of this being a peristent problem? Multiple versions of gems can be required I remember there was discussions about this in the past. Personally this is a feature it's quite strongly against because it's extremely hard to reason about. If you have library A using the gem G in version 1, and library B using the gem G in version 2, and end up with A being passed a G-v2 object, you may end up in a world of hurt. I understand this feature would be useful for bundler specifically to allow them to use gems internally without conflicting with the application (a problem they currently solve by vendoring), but outside of that I'm not convinced it's a desirable feature. I get that it can happen that you end up in a sticky situation with two dependencies being essentially incompatible because they require conflicting versions of another dependency, as it happened with the Faraday 2 transition a few years back, but I'm not convinced that working around the problem that way is a net positive. Namespace monkey patches This one isn't in your ticket, but from previous public talks I understand it is one? Here again I'd like to question how big of a problem monkey patches really are. It is true that 15 years ago, numerous popular ...

First seen: 2025-05-12 14:27

Last seen: 2025-05-12 19:28