aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-04-30 22:58:11 +0800
committerGitHub <noreply@github.com>2018-04-30 22:58:11 +0800
commit565b4a0f113f997e8ea576f7539ca0ed23102d55 (patch)
tree334804a3acb5d02909f7f6ea9fc54b9f7a54b197
parent9e61b25dc4cf09f95cdb0ca454fa48e879f91c36 (diff)
parent8782508e0b2d8c5bbf6d35f5a92ed1d993edc128 (diff)
downloaddexon-solidity-565b4a0f113f997e8ea576f7539ca0ed23102d55.tar
dexon-solidity-565b4a0f113f997e8ea576f7539ca0ed23102d55.tar.gz
dexon-solidity-565b4a0f113f997e8ea576f7539ca0ed23102d55.tar.bz2
dexon-solidity-565b4a0f113f997e8ea576f7539ca0ed23102d55.tar.lz
dexon-solidity-565b4a0f113f997e8ea576f7539ca0ed23102d55.tar.xz
dexon-solidity-565b4a0f113f997e8ea576f7539ca0ed23102d55.tar.zst
dexon-solidity-565b4a0f113f997e8ea576f7539ca0ed23102d55.zip
Merge pull request #4022 from ethereum/docslin
Update documentation about C3 linearization.
-rw-r--r--docs/contracts.rst10
1 files changed, 5 insertions, 5 deletions
diff --git a/docs/contracts.rst b/docs/contracts.rst
index 17eb23f7..5c298274 100644
--- a/docs/contracts.rst
+++ b/docs/contracts.rst
@@ -1066,12 +1066,15 @@ Multiple Inheritance and Linearization
Languages that allow multiple inheritance have to deal with
several problems. One is the `Diamond Problem <https://en.wikipedia.org/wiki/Multiple_inheritance#The_diamond_problem>`_.
-Solidity follows the path of Python and uses "`C3 Linearization <https://en.wikipedia.org/wiki/C3_linearization>`_"
+Solidity is similar to Python in that it uses "`C3 Linearization <https://en.wikipedia.org/wiki/C3_linearization>`_"
to force a specific order in the DAG of base classes. This
results in the desirable property of monotonicity but
disallows some inheritance graphs. Especially, the order in
which the base classes are given in the ``is`` directive is
-important. In the following code, Solidity will give the
+important: You have to list the direct base contracts
+in the order from "most base-like" to "most derived".
+Note that this order is different from the one used in Python.
+In the following code, Solidity will give the
error "Linearization of inheritance graph impossible".
::
@@ -1089,9 +1092,6 @@ The reason for this is that ``C`` requests ``X`` to override ``A``
requests to override ``X``, which is a contradiction that
cannot be resolved.
-A simple rule to remember is to specify the base classes in
-the order from "most base-like" to "most derived".
-
Inheriting Different Kinds of Members of the Same Name
======================================================