Open Ashraile opened 4 months ago
Heya @Ashraile and thanks for the issue. Now, just to be clear, we don't consider this to be a bug per-se, but the topic itself has been quite contentious and we still don't have a definitive decision on what to about the pure
decorator. Some people are for the opposite of what you suggest - i.e. strengthening pure
even further, but some are again the opposite of that. You can see some of the discussion in https://github.com/ethereum/solidity/issues/8153. There's some further reading in the following issues as well: https://github.com/ethereum/solidity/issues/12829, https://github.com/ethereum/solidity/issues/9554. The reason we don't consider it a bug is because it's technically reading a state variable (which of course most would assume to mean reading from storage). I'll triage this and keep it open, since it's definitely something that could be improved upon, but as you can see from the multitude of similar issues, it's not easy to come to an agreement, so it will take some time.
This issue has been marked as stale due to inactivity for the last 90 days. It will be automatically closed in 7 days.
Description
Immutable variables replace their values at deployment with compile-time constants (as inlined bytecode). This necessarily means that any getter functions for
immutable
value types do not view contract state and so can be defined aspure
instead ofview
, however the compiler does not allow this.Environment
Steps to Reproduce