currently view is not enforced. Calling a function that is neither 'view' nor 'pure' from within a function that is causes a warning, but compiles.
My question is what is the result from externally calling such a function, and is the result well defined? Does it return the correct result but simply not change state?
for example:
contract Test {
uint counter = 0;
function A() public returns (uint256) {
counter++;
return counter;
}
function B() public view returns (uint256) {
return A();
}
}
What happens if I call B() externally? does it for sure return the current counter without consuming gas, just without making a state change to the contract?