Open Gusarich opened 4 months ago
I like the idea
Same can probably be applied to function arguments. Example:
fun someFunction(x: Int, const y: Int) {
// x here is changable, y is not
x += y; // works
y += 1; // doesn't
}
The readOnlyVariables
lint in Misti could advice developers to replace let
with const
if the variable is never written.
There are already static constants in Tact that can be declared outside of functions and receivers, but what about the possibility of defining constants within function bodies to enhance code?
These
const
definitions would work almost identically tolet
statements, with the only difference being that such variables would be protected from overwriting and changing.