diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-08-23 02:09:35 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-23 02:09:35 +0800 |
commit | 0ffc5db82b24b4897d5d09cebbaadba37fa63b45 (patch) | |
tree | 023cefa5a9f00b0e6a5bf84d02745ab8e6666121 /docs/contracts.rst | |
parent | 210b4870a805620329793c8ba2177a3ff6e7b477 (diff) | |
parent | b1cdf81506de39502db0fb4a4b55ba8155f853ab (diff) | |
download | dexon-solidity-0ffc5db82b24b4897d5d09cebbaadba37fa63b45.tar dexon-solidity-0ffc5db82b24b4897d5d09cebbaadba37fa63b45.tar.gz dexon-solidity-0ffc5db82b24b4897d5d09cebbaadba37fa63b45.tar.bz2 dexon-solidity-0ffc5db82b24b4897d5d09cebbaadba37fa63b45.tar.lz dexon-solidity-0ffc5db82b24b4897d5d09cebbaadba37fa63b45.tar.xz dexon-solidity-0ffc5db82b24b4897d5d09cebbaadba37fa63b45.tar.zst dexon-solidity-0ffc5db82b24b4897d5d09cebbaadba37fa63b45.zip |
Merge pull request #2762 from ethereum/statemutability-view
Introduce view state-mutability (keep constant as alias)
Diffstat (limited to 'docs/contracts.rst')
-rw-r--r-- | docs/contracts.rst | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/docs/contracts.rst b/docs/contracts.rst index 7b972e17..0f1a882c 100644 --- a/docs/contracts.rst +++ b/docs/contracts.rst @@ -461,29 +461,32 @@ value types and strings. } -.. _constant-functions: +.. _view-functions: -****************** -Constant Functions -****************** +************** +View Functions +************** -Functions can be declared constant in which case they promise not to modify the state. +Functions can be declared ``view`` in which case they promise not to modify the state. :: pragma solidity ^0.4.0; contract C { - function f(uint a, uint b) constant returns (uint) { + function f(uint a, uint b) view returns (uint) { return a * (b + 42); } } .. note:: - Getter methods are marked constant. + ``constant`` is an alias to ``view``. + +.. note:: + Getter methods are marked ``view``. .. warning:: - The compiler does not enforce yet that a constant method is not modifying state. + The compiler does not enforce yet that a ``view`` method is not modifying state. .. index:: ! fallback function, function;fallback |