-
-
Save pdubroy/7003974 to your computer and use it in GitHub Desktop.
var x = require('x-1.3'); | |
var foo = require('foo'); | |
// Doesn't work because x is expecting v1.2 of the Thing interface. | |
foo.wiggle(x.makeThing()); |
var x = require('x-1.2'); | |
function wiggle(thingFromX) { | |
thingFromX.doSomething(); | |
} |
Not exactly. It's about making two different libraries (which I did not write) work together, when they each depend on different versions of another library.
But npm for example already handles that situtation by giving each module its own dependency tree.
How does that handle the problem shown above? The problem is if doSomething
has a different interface between version 1.2 and 1.3. In other words, the same name (doSomething
) has different meanings in each module.
Aah, now I get it!
Tricky thing, agreed
I'm pretty sure this is an unsolveable problem.
Detectable, yes, but not (generally) solvable. It basically boils down to type incompatibilities (Something that Javascript hides on first sight, but it's that), where the type of something changes between versions.
So, you want to require two different versions of the same lib inside your module?