Add support for "constant" keyword in tuples
Currently defining a variable is
<Typ> name = expression;
This can be non-obvious to developers who are used to keywords before declaring variables. Also in CashScript variables can be reassigned.
For that reason this ticket is to add support for let and const. Their functionality would be inline with other mainstream languages.
let would be for variables which can be reassigned.
const would be for variables which have a constant value.
Both would be block scoped.
Right now I don't really want to add type inference to the language, as I think the time could be better spent on other things. So I don't want to add a let keyword, but I'm open to reconsidering that in the future. I think adding a keyword for constant values could be useful though.
Solidity uses the constant keyword in Solidity to indicate that a variable can't be changed (Source). This can be added to CashScript as well. Shouldn't change anything about the compiler output, but instead it should throw an error in semantic analysis when a constant variable is reassigned.
I just realised that we probably should add this modifier for tuple assignment as well. What do you think @nathanielCherian?
For sure. I think we should wait until the modifier refactoring in #125 is merged, but it shouldn't be a tricky fix.