-
Notifications
You must be signed in to change notification settings - Fork 6.1k
mutable variables (immutable as default) #715
Copy link
Copy link
Closed as not planned
Labels
closed due inactivityThe issue/PR was automatically closed due to inactivity.The issue/PR was automatically closed due to inactivity.high effortA lot to implement but still doable by a single person. The task is large or difficult.A lot to implement but still doable by a single person. The task is large or difficult.high impactChanges are very prominent and affect users or the project in a major way.Changes are very prominent and affect users or the project in a major way.language design
Any changes to the language, e.g. new featuresAny changes to the language, e.g. new featuresneeds designThe proposal is too vague to be implemented right awayThe proposal is too vague to be implemented right awaystaleThe issue/PR was marked as stale because it has been open for too long.The issue/PR was marked as stale because it has been open for too long.
Metadata
Metadata
Assignees
Labels
closed due inactivityThe issue/PR was automatically closed due to inactivity.The issue/PR was automatically closed due to inactivity.high effortA lot to implement but still doable by a single person. The task is large or difficult.A lot to implement but still doable by a single person. The task is large or difficult.high impactChanges are very prominent and affect users or the project in a major way.Changes are very prominent and affect users or the project in a major way.language design
Any changes to the language, e.g. new featuresAny changes to the language, e.g. new featuresneeds designThe proposal is too vague to be implemented right awayThe proposal is too vague to be implemented right awaystaleThe issue/PR was marked as stale because it has been open for too long.The issue/PR was marked as stale because it has been open for too long.
Function parameters can be marked
immutable.Such variables are called immutable. The immutable property extends to expressions in the following way:
Immutable expressions cannot be assigned to (or be used in
++or--expressions) and they cannot be passed to internal functions as arguments that are not marked as immutable.For value types, the "immutable" property can be removed if they are rvalues (need to specify this some more), and also the transition from storage to memory and memory to storage can lose the immutable property.
Todo:
isPure, collect data in the TypeChecker about whether an expression is immutable++and--do not have immutable left-hand-sides"The constant keyword for functions is currently not enforced by the compiler."
It sounds like Solidity can enforce this and refuse to compile.