Forced/unnatural/unnecessary naming

Hi there everyone. I'm just starting with Rust and tbh I only invest my time in it because of the promises Rust makes about safe/deadlock/memory corruption etc. If not for those I'd never look twice at it.
So perhaps, lets start from the beginning and on the topic. Why invent new name that is already named and known for decades now to programmers? I'm talking about libraries. In Rust they for some bizarre reason called crates? Why!?! Why invent some weird name and add to the learning (however tiny would that be). Why not just stick with libraries? And the library word actually describes it better what it is than crate. Crate? Really? Weird and unnatural.

It’s probably because not all crates are libraries. A crate is the fundamental unit of compilation in Rust, and its compilation could result in a library, an executable program, a suite of tests, or a compiler extension, at least. It’s larger than most other languages’ compilation units, which tend to be a single source file (like C) or a singke class (like Java), and so none of the preexisting names were a good fit.

This reasoning tends to apply in general— when someone invents a name, it’s usually because they see some meaningful distinction between the thing they named and what came before. Trying to figure out that distinction is a great way to understand the thing better.


What you've described here is simply description of a source code and the output of such compilation can be one of number of things like for example exe, lib etc. So it is basically a source code. And in Rust it is a called a crate. Weird.
Don't get me wrong, I have nothing against inventing "spot on" names for things that require it. Crate is just not very descriptive/intuitive name for the things you've describes crate is - a source code.

In C/C++ the source file is the unit of compilation.
In Rust however, it is the crate, which usually consists of more than one source file.

The names "crate" and "cargo" (and maybe more) all follow a common theme. If I remember correctly those names were coined by the original developer of Rust (Graydon Hoare) and just stuck.
I also don't find them very good names but at this point they are well established in the Rust community.

1 Like

And as it happens too often, something very new already managed to established something weird and unnatural. Instead of being the new clean kid on the block without all those weirdnesses/awkwardness of the languages it tries to replace (C/C++) it creates its own original weirdness. Unbelievable...

I’d like to dispute your assertion that this is either weird or unnatural: Humans, including those that design programming languages, have a tendency towards whimsy. As far as I can tell, it seems to be an unavoidable side effect of creativity.


I couldn't put it better than you just did.

It is weird and unnatural.
We (programmers) have already well established and understood/recognized names. The name is source code.
So basically in rust source code is called a crate. Unbelivable...

No, in Rust, source code is called source code. “Crate” is a piece of Rust technical jargon that refers to the transitive closure of all source code files considered by a single invocation of rustc, the root namespace used during compilation, or the artifact produced by such an invocation, depending on context.


So basically what in other languages is called a library

If you're familiar with .NET, a "crate" in Rust is roughly the same as an "assembly" in .NET.


Sort of, but without the implication that its intended use is to provide an API to other pieces of Rust code.

1 Like

So basically we are back to my original question...

So it is after all that discussion, a form of library...

Calling binary crates like this NES emulator libraries seems a little bit forced, I certainly wouldn't call Unreal Engine a C++ library, let alone any of the games developed with it.

1 Like

It's a package then. We already have well established name.

Other languages use terms like package, bundle, assembly, gem, egg, wheel, etc, for the same idea. I’m not sure there is a “standard” name.


So lets add on top of that another one, instead of use what's available for the sake of originality...
Instead of making things easier for developers, let's add another name which names already something we have name for it...

Certainly crate doesn't sound more natural/obvious than package...

Isn't a package more like a module? I wasn't able to find a conclusive answer for what constitutes a package in C++, but again I wouldn't call Minecraft a Java package. Different languages having some unique terminology and some existing terms which are used in different ways seems like it's the norm. If I had to guess the answer to the original question of "why" was probably "why not", I think it's reasonable to view the naming as not that important of a decision.

1 Like