3 ms·
Most languages currently do not support this in a way that lets you specify dependencies from a package manager. And some don't support it at all; most C and C+
by ameliaquining 1y ago
Most languages currently do not support this in a way that lets you specify dependencies from a package manager. And some don't support it at all; most C and C++ toolchains, for example, don't have a way to compile and run a single source file in a single command.
- tracker1 1y agoExactly, that alone makes it far more useful/portable in practice than a lot of other languages for this type of thing. A python file can have a shebang, but it'll need a bunch of other files around it for module references, etc. Not to mention initialization/setup, etc. The fact that dependencies are referenced in the file and automatically handled at runtime (first or repeated) is a really nice feature to have... it's expressly why I started using Deno over other options for this.
- epage 1y agoThere are at least workarounds for a surprising number of languages: https://dbohdan.com/scripts-with-dependencies https://dbohdan.com/scripts-with-dependencies Read up on the details of each one when proposing the design for Cargo script to see what we could learn.
- ameliaquining 1y agoI would argue that third-party tools don't really cut it, because a lot of the value is being able to include a script inline in, e.g., an email or chat message, and that's undermined if the recipient has to download and install a separate tool. (uv gets half credit because adoption is rapidly rising and it has a shot at becoming a de facto standard, but I'll only award full credit to Python when pip supports this.) They're good for exploring the design space, though.
- epage 1y agoFully agree. I had a section in the Cargo RFC devoted to why a first class solution is important, see https://rust-lang.github.io/rfcs/3502-cargo-script.html#first-vs-third-party https://rust-lang.github.io/rfcs/3502-cargo-script.html#firs...