ruby / json

JSON implementation for Ruby
https://ruby.github.io/json
Other
677 stars 330 forks source link

Figure out what to do when different versions of `json` and `json_pure` are loaded #650

Open byroot opened 2 hours ago

byroot commented 2 hours ago

Ref: https://github.com/ruby/json/issues/646

There is no version constraints between the two, but they expose the same files in $LOAD_PATH, so if two different versions are loaded it can easily cause incompatibilities.

We should find a solution for this. Perhaps use require_relative? But even then, large parts of the implementation are in the global JSON module, so we can't load two namespaced versions of it.

headius commented 2 hours ago

Normally I'd say the common parts should be in a separate gem json_base that both json and json_pure depend upon (with a strict version). If they tried to activate different versions it would be an error earlier in library management, and even better it would not silently appear to load ok and then break.

However it would mean another gem in stdlib.

The only other alternative is shipping the common parts namespaced too.