Closed casperisfine closed 3 weeks ago
Isn't it a problem if lib/json.rb is loaded from json_pure because earlier in $LOAD_PATH, but then that ends up loading the C extension with require 'json/ext'
? Then you would get .rb files from both gems, potentially with different versions, and a confusing JSON::VERSION constant which represents only half of it, no?
Also in that scenario lib/json/common.rb
would be loaded from json_pure, but maybe there is some code there which is not compatible with what the C extension expects.
Hum, right, I think I need to use more require_relative
.
I think we should just have json_pure
an empty gem depending on json
, it seems intrinsically very brittle to have 2 gems which share some Ruby files (e.g. lib/json/common.rb
and lib/json/version.rb
) of potentially different versions.
If we wanted to just make sure the versions match we'd need to have json_pure depend on json same version, which is the same thing and then I think there is no point to ship the same files in two gems.
Fix: https://github.com/ruby/json/issues/650 Ref: https://github.com/ruby/json/issues/646
json_pure
currently doesn't work well at all becausejson/ext
is a default gem, so if you have code requiringjson/pure
and some other code requiringjson
, you end up with both loaded.If the
json
andjson_pure
versions match, it's not too bad, but if they don't match, you might run into issues with private APIs no longer matching.