1- Why is it only memory when using Value Types as parameters in functions? For example, would it be absurd to set it as calldata?

2- When we define state variables, they are stored in storage. Why can't we access the value types there with storage as in the reference types?

3- Are they stored in a new memory area after copying their values ​​to the value types that it defines as state variables? Because value types are constantly stored in a new memory area we can't reach with mi storage? For example, we can access it using a reference type storage.

I would be glad if you help. Thanks for your time.

1 Answer 1


The calldata memory is where the contract's input is stored. It is read only and it stores the input parameters for external functions.

Some types like uintXXX, bytesNN, address, bool, e.g. types smaller than 32 bytes are stored in the EVM stack. When they are in the contract's storage they have a slot that you could access with assembly but it is inaccessible from solidity code.

Types with variable length like string and arrays, could be stored in memory or contract's storage. Also structs could be stored in memory and storage.

Solidity has some oddities, like not having a reference type, but sometimes types in storage and memory act like references, and types like uint are passed by value even if they are in storage. Solidity works well for developing smart contracts and that's its main purpose.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.