Merge pull request #4093 from ethereum/prepareDropConstantKeyword

Prepare drop constant keyword.
This commit is contained in:
chriseth
2018-05-14 12:47:07 +02:00
committed by GitHub
20 changed files with 110 additions and 125 deletions
+1 -1
View File
@@ -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``.
+1 -1
View File
@@ -25,7 +25,7 @@ Storage
storedData = x;
}
function get() public constant returns (uint) {
function get() public view returns (uint) {
return storedData;
}
}
+1 -1
View File
@@ -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.
+5 -2
View File
@@ -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