Support "calldata" as an overloaded location for reference variables. #15000
Labels
feature
must have eventually
Something we consider essential but not enough to prevent us from releasing Solidity 1.0 without it.
Abstract
Disambiguate "memory" and "calldata" when overloading
Motivation
Lets consider the following library as a minimal example
We may want to get a hash of the content, or any other value that requires reading par of (but not all of) the structure.
Depending on where the structure lives, copying all of it to memory might be a waste (in our example, signature & metadata might be very large, and are not actually needed in getHash).
In these cases, it is more efficient to pass the structure as a reference, and only load/copy to memory what is actually going to be used.
This is true if the struct is in storage, but a similar logic applies to structures in calldata (even though the saving are smaller).
So far, solidity has no issue handling
but adding the third (calldata) version causes an error.
Specification
Distinguish
memory
andcalldata
datalocation so that overriden function do not clash when both localities are implemented separatly.Backwards Compatibility
TBD
The text was updated successfully, but these errors were encountered: