0

This question already has an answer here:

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;
    }
}

marked as duplicate by user9402, Community Aug 2 '17 at 12:21

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

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.