0

Can someone please help me understand why this smart contract compiles in ReMix?

What is the purpose of the word constant if it doesn't preclude the code from changing the state? I'm looking for a technical answer that explains why Solidity allows this, not just says "that's the way it is."

pragma solidity ^0.4.9;

contract ShouldNotCompile {
    address addr;
    function getSender() constant returns (address) {
        addr = msg.sender;
        return addr;
    }
}
0

As documentation states, enforcement of constant is simply not (yet?) implemented. It seems weird for me as well, I suppose, the devs just think this issue is of a lower priority.

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