In my experience, treating storage and memory variables the same is confusing and dangerous for devs (new and old). For a long time, I have adopted a different coding style for storage variables, as documented here, which is also partly used by Chainlink in their coding style guide here.
As the EIP-1153: Transient storage is on the horizon, I think it’s time to raise this suggestion up to have a clear view of storage access, making the code much more readable and avoiding all local variable name collisions:
- Storage variables are prefixed with
s_to indicate that they reside in storage and are expensive to read and write:
- Transient storage variables are prefixed with
t_to indicate that they must be reset before the transaction ends: