3 ms·
Here's a solution to the diamond dependency problem: Imports can only be done for a specific lexical scope. Also, imports must specify a particular version. Las
by stcredzero 11y ago
Here's a solution to the diamond dependency problem: Imports can only be done for a specific lexical scope. Also, imports must specify a particular version. Lastly, calls to a package go to a specific version of the package, and types are defined in a specific version. (This is why all imports must be done for a specific lexical scope.)
The same scheme could be used to resolve diamond dependencies in multiple inheritance as well.
- pcwalton 11y agoThat's essentially the solution Rust and Cargo adopt. It occasionally causes strange errors like "expected Foo, found Foo" (where the first Foo was, say, Foo version 1.1 and the second was Foo version 1.2), but the compiler now detects this situation and tries to explain what's going on. I'm certain I'm biased, but in my experience it's been the most robust way to handle versioning that I've dealt with.
- stcredzero 11y agoI proposed this in a Smalltalk newsgroup over a decade ago. The reaction? I was ridiculed. Imports naming specific versions would also allow better integration of code/build into a version control system. Actually, the entire OS should be built with version control in mind from the ground up.
- CyberDildonics 11y agoNo truly good idea will ever escape ridicule.
- bjz_ 11y ago> the compiler now detects this situation and tries to explain what's going on. Oh really? That's great news! I remember having that problem earlier this year and thinking that it wasn't the greatest from a usability standpoint.