The word const currently means three things:
&const as a mutability qualifier, supertype of "mut" and "" (immut). Directly analogous to C/C++'s meaning.
const x: ty = val; for constant globals. Same as the meaning in C/C++/Java/etc.
T: Const as a trait, which indicates "no embedded mutability". Corresponds to nothing in any other language, as far as I know.
I propose we change the third one, and leave the other two as they are. Const doesn't even mean the data is constant (it can be borrowed as mutable). In working on the regions paper, I figured this is always used, conceptually, to indicate a "freezable" data structure -- one which becomes deeply constant only when borrowed from immutably. Let's call it that.
related #3542 #3529
The word
constcurrently means three things:&constas a mutability qualifier, supertype of "mut" and "" (immut). Directly analogous to C/C++'s meaning.const x: ty = val;for constant globals. Same as the meaning in C/C++/Java/etc.T: Constas a trait, which indicates "no embedded mutability". Corresponds to nothing in any other language, as far as I know.I propose we change the third one, and leave the other two as they are.
Constdoesn't even mean the data is constant (it can be borrowed as mutable). In working on the regions paper, I figured this is always used, conceptually, to indicate a "freezable" data structure -- one which becomes deeply constant only when borrowed from immutably. Let's call it that.related #3542 #3529