(2013/08/13 2:25), drbrain (Eric Hodel) wrote:
> For files in the standard library, replacing a file loaded by require_relative that is not part of a gem is more difficult. To alter net/http/request.rb loaded by require_relative you must duplicate the tree of files that require_relative it in order to use the $LOAD_PATH trick. I see adding features of the standard library as default gems a workaround for this restriction.

I think this proposal depends on that how many people want to do such a
replacement.

Before reading comments, I had believed that there are no case to
replace only a file such as lib/net/http/request.rb required from
lib/net/http.rb. It depends on a version strictly and we can add/modify
behavior by monkey patching. However, I'm not a heavy user of Ruby :p.

If there are many such cases, I need to withdraw this proposal. (without
Eric's "default gem" proposal)


> How is require_relative more brittle that require? If a file is
removed from a gem it can be loaded from the wrong path (via -I if in a
gem or vice versa). Using require_relative the error is immediate and
obvious. It seems to eliminate this class of error entirely.

+1 from design perspective.

-- 
// SASADA Koichi at atdot dot net