mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Prefer view over constant in the documentation.
This commit is contained in:
parent
2c3f57bec6
commit
1a014f83cc
@ -1,6 +1,7 @@
|
||||
### 0.4.24 (unreleased)
|
||||
|
||||
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.
|
||||
* 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.
|
||||
|
@ -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``.
|
||||
|
@ -25,7 +25,7 @@ Storage
|
||||
storedData = x;
|
||||
}
|
||||
|
||||
function get() public constant returns (uint) {
|
||||
function get() public view returns (uint) {
|
||||
return storedData;
|
||||
}
|
||||
}
|
||||
|
@ -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.
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user