diff options
author | Daniel Kirchner <daniel@ekpyron.org> | 2018-05-08 19:08:22 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2018-05-09 21:06:47 +0800 |
commit | 1a014f83cc8670a7c15c0338a33df124e982703f (patch) | |
tree | 6cc86e8ca6cab831ed840ac21a33639cb7f86a45 /docs | |
parent | 2c3f57bec6eaa8d52a644f0b6abe7ab17b05a2ee (diff) | |
download | dexon-solidity-1a014f83cc8670a7c15c0338a33df124e982703f.tar dexon-solidity-1a014f83cc8670a7c15c0338a33df124e982703f.tar.gz dexon-solidity-1a014f83cc8670a7c15c0338a33df124e982703f.tar.bz2 dexon-solidity-1a014f83cc8670a7c15c0338a33df124e982703f.tar.lz dexon-solidity-1a014f83cc8670a7c15c0338a33df124e982703f.tar.xz dexon-solidity-1a014f83cc8670a7c15c0338a33df124e982703f.tar.zst dexon-solidity-1a014f83cc8670a7c15c0338a33df124e982703f.zip |
Prefer view over constant in the documentation.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/contracts.rst | 2 | ||||
-rw-r--r-- | docs/introduction-to-smart-contracts.rst | 2 | ||||
-rw-r--r-- | docs/security-considerations.rst | 2 | ||||
-rw-r--r-- | docs/style-guide.rst | 7 |
4 files changed, 8 insertions, 5 deletions
diff --git a/docs/contracts.rst b/docs/contracts.rst index 3576cd7b..487e80ae 100644 --- a/docs/contracts.rst +++ b/docs/contracts.rst @@ -473,7 +473,7 @@ The following statements are considered modifying the state: } .. note:: - ``constant`` on functions is an alias to ``view``, but this is deprecated and is planned to be dropped in version 0.5.0. + ``constant`` on functions is an alias to ``view``, but this is deprecated and will be dropped in version 0.5.0. .. note:: Getter methods are marked ``view``. diff --git a/docs/introduction-to-smart-contracts.rst b/docs/introduction-to-smart-contracts.rst index 84b1fff8..d1789c44 100644 --- a/docs/introduction-to-smart-contracts.rst +++ b/docs/introduction-to-smart-contracts.rst @@ -25,7 +25,7 @@ Storage storedData = x; } - function get() public constant returns (uint) { + function get() public view returns (uint) { return storedData; } } diff --git a/docs/security-considerations.rst b/docs/security-considerations.rst index 3e1c3a12..4133edb1 100644 --- a/docs/security-considerations.rst +++ b/docs/security-considerations.rst @@ -120,7 +120,7 @@ Gas Limit and Loops Loops that do not have a fixed number of iterations, for example, loops that depend on storage values, have to be used carefully: Due to the block gas limit, transactions can only consume a certain amount of gas. Either explicitly or just due to normal operation, the number of iterations in a loop can grow beyond the block gas limit which can cause the complete -contract to be stalled at a certain point. This may not apply to ``constant`` functions that are only executed +contract to be stalled at a certain point. This may not apply to ``view`` functions that are only executed to read data from the blockchain. Still, such functions may be called by other contracts as part of on-chain operations and stall those. Please be explicit about such cases in the documentation of your contracts. diff --git a/docs/style-guide.rst b/docs/style-guide.rst index 0c58f3eb..6b28f2ab 100644 --- a/docs/style-guide.rst +++ b/docs/style-guide.rst @@ -269,7 +269,7 @@ Functions should be grouped according to their visibility and ordered: - internal - private -Within a grouping, place the ``constant`` functions last. +Within a grouping, place the ``view`` and ``pure`` functions last. Yes:: @@ -285,7 +285,10 @@ Yes:: // External functions // ... - // External functions that are constant + // External functions that are view + // ... + + // External functions that are pure // ... // Public functions |