aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/contracts.rst8
-rw-r--r--docs/control-structures.rst12
2 files changed, 10 insertions, 10 deletions
diff --git a/docs/contracts.rst b/docs/contracts.rst
index 5c298274..9d47b543 100644
--- a/docs/contracts.rst
+++ b/docs/contracts.rst
@@ -24,8 +24,8 @@ Creating contracts programatically on Ethereum is best done via using the JavaSc
As of today it has a method called `web3.eth.Contract <https://web3js.readthedocs.io/en/1.0/web3-eth-contract.html#new-contract>`_
to facilitate contract creation.
-When a contract is created, its constructor (a function with the same
-name as the contract) is executed once.
+When a contract is created, its constructor (a function declared with the
+``constructor`` keyword) is executed once.
A constructor is optional. Only one constructor is allowed, and this means
overloading is not supported.
@@ -982,7 +982,7 @@ virtual method lookup.
Constructors
============
-A constructor is an optional function declared with the ``constructor`` keyword which is executed upon contract creation.
+A constructor is an optional function declared with the ``constructor`` keyword which is executed upon contract creation.
Constructor functions can be either ``public`` or ``internal``. If there is no constructor, the contract will assume the
default constructor: ``contructor() public {}``.
@@ -1139,7 +1139,7 @@ Example of a Function Type (a variable declaration, where the variable is of typ
function(address) external returns (address) foo;
-Abstract contracts decouple the definition of a contract from its implementation providing better extensibility and self-documentation and
+Abstract contracts decouple the definition of a contract from its implementation providing better extensibility and self-documentation and
facilitating patterns like the `Template method <https://en.wikipedia.org/wiki/Template_method_pattern>`_ and removing code duplication.
.. index:: ! contract;interface, ! interface contract
diff --git a/docs/control-structures.rst b/docs/control-structures.rst
index f3c351dd..f18e1e10 100644
--- a/docs/control-structures.rst
+++ b/docs/control-structures.rst
@@ -293,12 +293,7 @@ Solidity internally allows tuple types, i.e. a list of objects of potentially di
// Common trick to swap values -- does not work for non-value storage types.
(x, y) = (y, x);
// Components can be left out (also for variable declarations).
- // If the tuple ends in an empty component,
- // the rest of the values are discarded.
- (data.length,) = f(); // Sets the length to 7
- // The same can be done on the left side.
- // If the tuple begins in an empty component, the beginning values are discarded.
- (,data[3]) = f(); // Sets data[3] to 2
+ (data.length,,) = f(); // Sets the length to 7
// Components can only be left out at the left-hand-side of assignments, with
// one exception:
(x,) = (1,);
@@ -307,6 +302,11 @@ Solidity internally allows tuple types, i.e. a list of objects of potentially di
}
}
+.. note::
+ Prior to version 0.4.24 it was possible to assign to tuples of smaller size, either
+ filling up on the left or on the right side (which ever was empty). This is
+ now deprecated, both sides have to have the same number of components.
+
Complications for Arrays and Structs
------------------------------------