Prefer view over constant in the documentation.

This commit is contained in:
Daniel Kirchner 2018-05-08 13:08:22 +02:00 committed by Alex Beregszaszi
parent 2c3f57bec6
commit 1a014f83cc
5 changed files with 9 additions and 5 deletions

View File

@ -1,6 +1,7 @@
### 0.4.24 (unreleased) ### 0.4.24 (unreleased)
Features: Features:
* Remove deprecated ``constant`` as function state modifier from documentation and tests (but still leave it as a valid feature).
* Build System: Update internal dependency of jsoncpp to 1.8.4, which introduces more strictness and reduces memory usage. * Build System: Update internal dependency of jsoncpp to 1.8.4, which introduces more strictness and reduces memory usage.
* Code Generator: Use native shift instructions on target Constantinople. * Code Generator: Use native shift instructions on target Constantinople.
* Gas Estimator: Only explore paths with higher gas costs. This reduces accuracy but greatly improves the speed of gas estimation. * Gas Estimator: Only explore paths with higher gas costs. This reduces accuracy but greatly improves the speed of gas estimation.

View File

@ -473,7 +473,7 @@ The following statements are considered modifying the state:
} }
.. note:: .. 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:: .. note::
Getter methods are marked ``view``. Getter methods are marked ``view``.

View File

@ -25,7 +25,7 @@ Storage
storedData = x; storedData = x;
} }
function get() public constant returns (uint) { function get() public view returns (uint) {
return storedData; return storedData;
} }
} }

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: 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 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 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 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. and stall those. Please be explicit about such cases in the documentation of your contracts.

View File

@ -269,7 +269,7 @@ Functions should be grouped according to their visibility and ordered:
- internal - internal
- private - private
Within a grouping, place the ``constant`` functions last. Within a grouping, place the ``view`` and ``pure`` functions last.
Yes:: Yes::
@ -285,7 +285,10 @@ Yes::
// External functions // External functions
// ... // ...
// External functions that are constant // External functions that are view
// ...
// External functions that are pure
// ... // ...
// Public functions // Public functions