6 ms·
I used to describe my preferred family of languages as: - C when I absolutely had to (kernel/modules/plumbing). - Python for scripting and broad accessibility
by JoshTriplett 12y ago
I used to describe my preferred family of languages as:
- C when I absolutely had to (kernel/modules/plumbing).
- Python for scripting and broad accessibility.
- Haskell when I had the choice and I knew everybody who would work on the project.
I was skeptical of Rust when it first came out, due in large part to the many different kinds of pointers it originally had, many of which involved significant manual memory management. But now, with a strong static type system, garbage collection, pattern matching, associated types, and many other features, Rust is looking like a serious contender to replace all three of those languages for me.
Still waiting to see if it develops a strong following, community, and batteries-included library ecosystem, but I need to start doing more experiments with Rust.
Disappointing to see yet another language-specific package management system (Cargo), though.
- steveklabnik 12y agoRust does not have any garbage collection, to be clear. All your other features are correct though :) (We have previously said "opt-in GC" but that was a lie. See https://news.ycombinator.com/item?id=8312327 https://news.ycombinator.com/item?id=8312327 for more.)
- JoshTriplett 12y agoYeah, I should have said that more clearly. Automatic memory management (never having to call free), not garbage collection. Which is arguably more awesome: whenever the compiler can figure out at compile time when you'll stop using memory, it can statically decide to reclaim it there.
- wycats 12y agoYes! The fact that Rust has zero-runtime-overhead automatic memory management is a big deal. I've been using Rust for almost a year, and it's been a source of great delight for me.
- haberman 12y agoI am a huge fan of no required GC, and of precise refcounting. But does Rust have anything on the roadmap to handle truly cyclic structures that don't lend themselves to a weak pointer approach?
- someone13 12y agoOne option would be to allocate objects out of an arena[0] and then destroy the entire thing at once when you're finished with the contained objects. [0] http://doc.rust-lang.org/arena/index.html http://doc.rust-lang.org/arena/index.html
- haberman 12y agoMakes sense. If anyone is interested, I think it could be interesting to see if the refcounting approach I developed for handling cyclic references in my library "upb" would work as a Rust library: https://github.com/haberman/upb/blob/master/upb/refcounted.h https://github.com/haberman/upb/blob/master/upb/refcounted.h The basic idea is that you refcount groups of objects instead of refcounting objects independently. You compute the groups dynamically such that no cycle can span groups. This is sort of like an arena, except that no arena is ever explicitly created, and the collection can be more precise than an arena. In my library, objects go through a two-phase lifecycle. First they are mutable, then they are frozen, after which no further mutations can be made. When an object is frozen, its outbound pointers are also frozen. The nice property of this scheme is that you can perfectly compute these "virtual arenas" by computing strongly-connected components at freeze time. This makes the scheme optimal for frozen objects. For mutable objects, the groups are computed more conservatively and objects may not get freed as often as they otherwise would with a perfect scheme (ie. the same downside of an arena). I would love to know how this scheme might possibly be modeled in Rust. Since Rust also has strong semantics around mutability and immutability, it seems possible that a very nice idiomatic Rust interface could be implemented around this scheme, giving more precise cleanup than an arena while still allowing circular structures.
- bitbckt 12y ago
- pestaa 12y agoCurious to hear more about language-specific (though OS-agnostic!) package management systems. IMO composer is the best thing ever happened to PHP, Ruby gems are huge, Python eggs also make a very useful ecosystem. OpenSUSE's Open Build System would be great to ship independent packages, but those are again heavily tied to Unices, hence leaving other platforms behind.
- JoshTriplett 12y ago> Curious to hear more about language-specific (though OS-agnostic!) package management systems. As far as I can tell, one of the main justifications for most language package management systems is "we also run on Windows/OSX, which has no package management, so we'll invent our own". As a result, users of systems that do have sane package management get stuck with multiple package management systems, one for the distro and one for every language. Even then, I find it disappointing that nobody has built a cross-platform package management system for arbitrary languages to unify those efforts.
- kungfooguru 12y agoThe problem with language package management systems is they've been used for installing user facing software. As a developer tool I think it is the perfect way to go. And you should add Linux to your Windows/OSX as being an issue, which Linux package management tool would you build packages for? All of them? The end user package management provided by the OS should be for installing end user packages and the language tool for installing and publishing libraries and dev tools.
- wycats 12y ago> The problem with language package management systems is they've been used for installing user facing software. As a developer tool I think it is the perfect way to go. Precisely so.
- smacktoward 12y agoThe other justification is generally a clash of cultures: the people who maintain distro/OS package managers generally come out of the culture of sysadmins, who value stability over feature-richness, while the people working the language communities generally come out of the culture of developers, whose priorities are the exact opposite. When languages try to hook into existing OS-level systems, the people on the language end get frustrated by the way the people on the package-manager end don't hurry to rush out bleeding-edge versions of packages the second they hit Github. To the package-manager people, that's no big deal, their orientation towards stability and predictability makes them comfortable with waiting a little for the coffee to cool. But to the developers, who want to get their hands on the Latest and Greatest Right Now!, it feels like slogging though molasses. So the developers eventually end up blowing their stacks and stomping off yelling "Yeah? Well fine, we'll build our own package manager then! With blackjack! And hookers!"
- pcwalton 12y ago> Disappointing to see yet another language-specific package management system (Cargo), though. It's been a huge step up from makefiles in developing Servo. I can barely ever bring myself to go back to using make and git submodules now. The workflow of breaking up your project into small, self-contained packages that people hack on independently and are all built with a package manager that natively understands the language and can build without a single line of shell is a huge improvement over vendoring dependencies and dealing with a maze of configure scripts or arcane make/(insert your preferred replacement here) files. It improved compilation time a lot too!
- bjz_ 12y ago> It's been a huge step up from makefiles in developing Servo. As a maintainer of a number of Rust libraries I highly agree! It has definitely won over a few skeptical collaborators of mine (who were fans of Make).
- doe88 12y ago> Disappointing to see yet another language-specific package management system (Cargo), though. Coming from Python I find Cargo very very smart and very well thought so far, it is not feature heavy, but everything has a very clear and useful purpose. For instance today I found that if I created a file .cargo/config I could override my dependancies to make Cargo search projects on my fs instead of grabbing them on Github, while doing developments it's a big thing I think.
- Ygg2 12y ago> Disappointing to see yet another language-specific package management system (Cargo), though. I don't think it is. You need support for Rust modules on various platforms Linux/Mac/Windows(possibly Android). No single tool works on all those platforms. Cargo does and it has minimal dependencies. Not having to juggle three different configuration (CMake, Makefile, etc.) on different platform is actually pretty great.
- pjmlp 12y ago> Disappointing to see yet another language-specific package management system (Cargo), though So what is the solution to have portable packages for: - RPM systems - Debian systems - tarball systems - Pkg systems - MSI systems - Mainframe OS - Embedded OS - Aix/HP-UX/Solaris package systems - ...
- adrusi 12y agoThe goal of the [nix](http://nixos.org/ http://nixos.org/) project is to solve this, and every time anyone brings up a package manager on HN, someone has to mention nix. The reality is that nix is really nice, but isn't any better than making a new package manager until it has wide adoption, so no one is using it.
- steveklabnik 12y agoNix was brought up during the discussion that led to Cargo, but no Windows support is a deal breaker.
- derefr 12y agoWouldn't it still have been less effort to port Nix to Windows, than to write an entirely new package manager and then port it to every OS?
- steveklabnik 12y agoIf that were the only downside, possibly. I don't really do Windows development, so I can't tell you how difficult porting Nix would be. There's large advantage to having a packaging system that knows your language well. It's going to have tighter integration than a generic one ever could.
- pmahoney 12y agoI would probably make the same decision, but I hope in the end Caro is easy to wrap with Nix, which is a breath of fresh air particularly when needing to mix dependencies that cross language boundaries and share those build recipes with a team. Previously, I wrote shell scripts and worried whether everyone on the team had rsync installed, or xmlstarlet, or some other less common tool. Now I wrap those scripts in a Nix package that explicitly depends on all those and distribute with confidence. It's fantastic. Bundler and rubygems, for example, do various things that make good support within Nix rough. Two examples: 1. rubygems has no standard way of declaring dependencies on C libraries; 2. as far as I know there is no way to ask Bundler to resolve dependencies, create a Gemfile.lock, but not install any gems (I realize github gems must be downloaded to see the gemspec...)
- dbaupp 12y agoAs others have said, having a package management system that deeply understands the language and tooling is awesome. Examples: - Rust has a distributed-by-default documentation generator (rustdoc), cargo knows this and provides `cargo doc` to render a library's docs with it. - rustdoc can run code examples in the documentation as tests, to check that everything is up-to-date, `cargo test` does this (along with running the in-source unit tests and any external tests). - the Rust compiler allows for plugins, which are dynamic libraries loaded into the compiler and can be used for things like custom macros (aka procedural macros aka syntax extensions) and custom compiler warnings. cargo understands these, allows them to be 'imported' via the normal dependency mechanism, and specifying `plugin = true` in a package makes cargo do the right thing, e.g. building as a dynamic library (static libraries are the default) and compiling for the correct target when cross-compiling. I'm sure all of this is possible with other systems, but it seems unlikely to be so nice to use.
- seabee 12y agoIt's very similar to Racket, and yes, it is nice to use! Other systems can get you much of the way there (node, Python are the only ones I'm really familiar with) but I suspect you need a little language help to achieve the same kind of convenience.
- deleted 12y ago[deleted]
- sigzero 12y ago> Disappointing to see yet another language-specific package management system (Cargo), though. No, I don't want my language to be bound to someone else's package manager at all.
- dscrd 12y ago>Disappointing to see yet another language-specific package management system (Cargo), though. As a packager in a Linux distro, I'm disappointed every time somebody tries to cram in PL-specific packages inside distro packages.
- kazagistar 12y agoInteresting, how do you get around it, when those packages are depended upon by user facing software?
- InclinedPlane 12y ago> Disappointing to see yet another language-specific package management system (Cargo), though. That's a much bigger problem to tackle, and one that nobody has really thought much on or done much work with. Package management is a tough problem in the abstract, and it's a big challenge to create a meta-package management infrastructure, more so when there doesn't seem to be any money in it (at least not easily).