Open byroot opened 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.
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 globalJSON
module, so we can't load two namespaced versions of it.