-
Notifications
You must be signed in to change notification settings - Fork 5.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A way to always import the correct(*) std version and runtime compatibility #3320
Comments
Not sure if this will solve the problem Lines 14 to 18 in 2cd22b5
macro_rules! std_url {
($x:expr) => {
- concat!("https://deno.land/std@v0.23.0/", $x)
+ concat!("https://deno.land/std@v", env!("CARGO_PKG_VERSION"), "/", $x)
};
} |
std and cli are synchronized once again. not the same versions, but they release at the same time. |
I was hoping there would be more discussion on this issue than what I see. Given this statement on the std lib README: https://deno.land/std@0.180.0#releases
... does this mean that any libraries / frameworks we build on deno, we should take into account the minimum version of the deno runtime we wish to support, and based on that, using the above A bit more guidance would be appreciated as we build our application ecosystem tooling on top of deno 🙏 |
Consider this scenario: You are writing a 3rd part module. It uses std modules. What is the correct std version that you should use?
The obvious answer would be to use the same std version as the version of the runtime, but you don't know what version of the runtime will your library run under because this is outside of your control.
(*) Note that the "correct" version is not obvious right now even if you were to hardcode the version yourself - is the correct std version the one that your module was developed with, no matter what Deno runtime is currently running (potential Deno runtime-std incompatibility)? Or is the correct std version the one that is the same as the current version of the runtime, no matter what version the library was developed with it (potential module-std incompatibility)? (Either or none of those answers can be true depending on the convention/discipline of developing the std modules but it has to be considered explicitly.)
Something to consider as well: Is there a risk of importing multiple versions of std modules by different dependencies of the same program? Do we want to avoid that or should this be a common practice? (If the std version is hardcoded into each dependency then it will be more than likely.)
This is a question that cannot be avoided, because if you publish a module that uses std (as probably most of nontrivial modules will), you need to choose a version number. If you hardcode the current version of Deno that you currently have, then when a new version od Deno (and std) comes out, you can either:
In both cases, either newer versions of Deno will use older versions of std, or older versions of Deno will use newer versions of std, both of which can lead to compatibility problems.
As a more general case, the question is whether we should:
(This question is important for both hardcoding the version in the import and using a mechanism of dispatching to the correct version.)
Semver doesn't actually let us do what we need here, which would really be something like this:
Normal semver semantics will only allow us to:
Currently we can probably expect most of Deno early adopters to use the latest version of Deno and update as soon as a new version is available, but in the future we will want our libraries to be compatible with multiple versions of Deno and std modules, and to also cooperate with other libraries that also use std.
The current versioning scheme is time based with predictable version schedule. Hopefully, when the 1.x is out, it will follow semver rules so we can be sure that if our module is compatible with deno/std 1.5.x then it may not be compatible with 1.4.x but it will certainly be compatible with 1.35.x (unless there was a mistake with a version bump somewhere, but in principle this should at least be a reasonable expectation), but I would like it to use std 1.20 when running on Deno 1.20 and 1.35 when running on Deno 1.35 and the question is: How can this be done?
Making sure that the std and runtime versions match will make it easier to develop both std and the runtime. I may be wrong but as far as I see there is an implicit assumption that a certain version of std does not have to be compatible with older versions of Deno, but it would be useful to be explicit about:
For the problems above I see few solutions, all with their own problems:
import { test } from "https://deno.land/std/testing/mod.ts";
which imports the latest commit on the master branch of the std)--allow-net
to use it)I've read few discussions about std module aliasing and bundling but I didn't see any ideas on how to handle it for the future when we will have people using dependencies that may not always be updated as often as std, and running on unknown versions of the runtime.
Has there been any brainstorming about this already?
Related issues: #8, #288, #1397, #2288, #3268
Update: #3395
The text was updated successfully, but these errors were encountered: