C++ has three categories of constness - the default one, so "mutable", mutable
which walks around const
, and const
, which stops modification, but not of mutable
members. This is obviously kind of backwards, and that's because the default is not immutable.
Rust has two categories of constness - the default one, so immutable, and mut
, which marks a declaration as mutable. This is also obviously wrong, because you cannot have a "this might be mutated, but you cannot do that" kind of a, say, argument to a function. One could say this is justified, because it makes creating data races harder, but I'd like to argue that that is not true in any aspect, at least in the "mutable and non-unique means an actor" model of Vapor.
Vapor has three categories of reference constness:
- the default one, so immutable; the default kind of a reference is called "a reference to an immutable object"
mutable
, which allows modification to an object. You can have multiple references to amutable
object, but once you