Back in 2006, Graydon Hoare started working on Rust as a small project. Hoare also worked on the Servo browser engine. His goal for Rust was that it might help with the development said browser engine. Since the engine (like almost all other browser engines) was written in C++ at that time, Rust was basically a C++ replacement for Hoare.
So using the same logical operators as C++ seemed just natural.
When the GitHub repository was created in 2010, &&
and ||
were already in the Rust language. See the lazy-and-or.rs
test during the second commit in the repository:
if (true && x) { ... }
Over time, the language design process got a lot more democratic and a lot more ideas appeared. But it wasn't until 2016 that someone officially proposed adding not
, and
and or
as an RFC.
But as you can see the RFC was closed. The contributor withoutboats explained it like this:
If I were designing a language from the beginning, I would probably prefer and
and or
. But we are generally opposed to contextual keywords unless absolutely necessary, contextual keywords in expression contexts are particularly difficult to introduce, and we tend to avoid syntactic sugar of the "pick your poison" variety.
It is important that at that point !
, &&
and ||
were already been stabilized for more than a year. So the only option was to add alternative operators, but not replace those ones. That didn't seem worth it.
Disclaimer: I only joined the Rust community in 2014. There might have been larger discussions about this in IRC or other media I can't search. But this is all I could find.