4 ms·
I found that attractive when I first learned Python, but when I (much more recently) started picking up Rust, I was blown away by how easy and normal it is to u
by geofft 7y ago
I found that attractive when I first learned Python, but when I (much more recently) started picking up Rust, I was blown away by how easy and normal it is to use external packages: the build tool and package manager are the same thing and shipped with the language, the hello-world-equivalent docs assume you're using it, and even the Rust compiler and standard library themselves can (carefully) depend on external packages. Having run up against limits of the Python standard library several times in years of writing production software in it and not just learning it, I find the batteries-not-includes-but-easy-to-install approach better on the whole. (Rust is not the only language that does this - my impression is Node/NPM and Swift, at least, are similar - but it's the one I happen to be familiar with.)
In Python's defense, this was not obvious at the time; my understanding is Rust came to this approach by looking at the experience of Python and other languages. When Python's standard library was first being written, there were no easy package managers for any language, and the normal thing to do for installing dependencies in e.g. C was to grab random tarballs and figure out how to build and deploy them yourself. So avoiding that process made perfect sense.
- civility 7y ago> Having run up against limits of the Python standard library several times in years of writing production software in it and not just learning it, I find the batteries-not-includes-but-easy-to-install approach better on the whole. Obviously it doesn't apply to everyone, and it certainly doesn't apply to most startups or open source developers, but I spent most of the last 20 years working in environments where you have to get permission for every third party library you bring on to the network. Many networks were essentially "airgapped", so it's not like you could just ignore the rules. The bureaucratic process alone meant that we preferred large bundles like Anaconda or Qt. Trying to use Cargo as it is typically used and documented would be a complete non-starter.
- geofft 7y agoYes, my own employer is similar (you don't need permission, but production systems have no internet access and so you need to pre-download all your tarballs etc.), and cargo doesn't work right. But I think there is work on pointing cargo at an internal mirror. We do have an internal PyPI mirror (with devpi) and we point `pip` at that, and it works pretty well.
- steveklabnik 7y agoHm, Cargo should absolutely work in this environment; it’s required by the Firefox and Debian build systems, for example. (Pointing at an internal mirror is now stable. Setting up that mirror is the hard part.)
- bscphil 7y ago>Obviously it doesn't apply to everyone, and it certainly doesn't apply to most startups or open source developers, but I spent most of the last 20 years working in environments where you have to get permission for every third party library you bring on to the network. Situations like this will really make you appreciate "batteries included". I think this particular issue is fairly revealing of the attitudes common among programmers of different languages. I think it's a good thing to be skeptical of a program pulling in a bunch of standard libraries over the Internet. It worries me when I find something on Github I want to try and I can't download and compile it without it pulling in 30 or 100 other libraries that I haven't looked at or decided to trust come along for the ride. I don't like that way of doing software, and unfortunately it's the norm in node and starting to become a norm in Rust as well. Real security fails have been caused this way in node's case at least. Even in cases when Python programs depend on external libraries, I usually don't need to use pip for anything because Python programs will pull in dependencies provided by your distribution just fine. (My distribution doesn't even have any Rust libraries, so even if dynamic linking is possible in Rust not many people are shipping software that way.) "Download by default" is a worse way of doing things, and it makes me sad to see newer languages like Go and Rust embracing it.
- roca 7y agoStandard libraries serve several functions. One of them is to bless certain versions of certain libraries as "known good". This can be done outside the standard library too, without incurring the penalties of actually moving things into the standard library. Rust definitely needs more work in this area though.
- RayDonnelly 7y agoYou can use `conda install rust_osx-64` on macOS and `conda install rust_linux-64` to use `cargo` with the Anaconda Distribution libraries and tools (including its compilers).
- mjw1007 7y agoRust is good at many things, but it's not as attractive for Python for the sort of program you write when a shell script gets a bit too complicated and you want to write it in a proper language. So Rust can get away more easily without having support for things like command line parsing in the standard library, because it isn't really trying to support situations where it would be inconvenient to give your program its own project directory and Cargo.toml and all.
- hermanradtke 7y agoThis is a pretty niche case imo. If you really want a stand-alone dole, you can forego the use of Cargo.toml and instead use std::env::args to get command line arguments. If it really matters, then do it right (in whatever language makes the most sense).
- ryl00 7y ago> When Python's standard library was first being written, there were no easy package managers for any language Wasn't perl's CPAN developed around that time period (mid '90s) ?
- geofft 7y agoEmphasis on easy :-P Using CPAN in even the late '00s was an ordeal.
- qbaqbaqba 7y agoIt just took ages to install and test some huge and popular modules like Catalyst, Moose. However, once installed and tested they would just on your system. And it wasn't that easy for modules creators and core developers as red hat was notorious for shipping decades of Perl versions (5.10 times).
- Aeolun 7y agoNode is ostensibly batteries included, but they’re weird, arcane batteries powered by tears. Therefore, to get anything done easily usually requires an external package.
- petre 7y agoNode doesn't even have a stdlib. You have to npm or yarn anything. And yes most of the time it will end in tears. That's not my definition of batteries included, but rather some batteries might explode, others might only ignite, we wish you the best of luck.