Re:Yehuda Katz's 10 Favorite Things About Ruby
by wycats on Monday August 24, 2009 @04:45PM
(#783304)
Indeed. It's probably wise to use namespaced internal methods inside of libraries or frameworks. However, Rails has historically pioneered new language features that eventually make their way into the language itself (Object#tap, Enumerable#group_by, etc. etc.).
In Rails 3, we've made it reasonable to pull in just small pieces of the ActiveSupport library, making it more likely that users will reuse functionality from there rather than reinvent the wheel.
Of course, it's not perfect.
Re:Yehuda Katz's 10 Favorite Things About Ruby
by simonw on Tuesday August 25, 2009 @03:05AM
(#784351)
Am I right in thinking that once a piece of ActiveSupport is pulled in anywhere in the codebase it will affect ALL Ruby objects, rather than having its effect scoped to just the module that included it?
Re:Yehuda Katz's 10 Favorite Things About Ruby
by wycats on Wednesday September 02, 2009 @10:06PM
(#801604)
Yep. You'd be modifying the String class itself, not just Strings that find their way into some file.
Re:Yehuda Katz's 10 Favorite Things About Ruby
by steveklabnik on Monday August 24, 2009 @04:54PM
(#783327)
Well... yes. You're right. If you're depending on one behavior rather than the other, then totally. I guess I was thinking about it more in terms of two different implementations of the same thing. "If we don't have a quicksort defined yet, make one."
One of the libraries is going to break.