3 ms·
But what do you do in a typed language? For example, suppose you have modules A and B, which depend on module C. Let's also say that module A has a function foo
by wtetzner 11y ago
But what do you do in a typed language? For example, suppose you have modules A and B, which depend on module C. Let's also say that module A has a function foo that return a value of type C.t, and module B has a function bar that accepts a value of type C.t.
Now let's say that module A is depending on version 1.0.0 of module C, and module B is depending on version 1.5.2 of module C.
Does B.bar(A.foo()) still work? Is type t the same in C version 1.0.0 and 1.5.2?
- eknkc 11y agoGood point. But if B.bar accepts an interface that C.t implements, then everything should work just fine and that should be the way to go on public APIs.
- wtetzner 11y agoBut what if the interface is defined in C? The interface has to live somewhere, and wouldn't it be versioned too?
- jasonwatkinspdx 11y agoI think the pragmatic approach is to just let that be a type analysis failure and force the user to deal with it. We don't need the module system to be automatically perfect in every imaginable extreme, we need it to be fundamentally safe, and then do sane useful things in the situations that are safe.