aboutsummaryrefslogtreecommitdiffstats
path: root/docs/contracts.rst
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-04-30 22:15:41 +0800
committerchriseth <chris@ethereum.org>2018-04-30 22:15:41 +0800
commit8782508e0b2d8c5bbf6d35f5a92ed1d993edc128 (patch)
tree334804a3acb5d02909f7f6ea9fc54b9f7a54b197 /docs/contracts.rst
parent9e61b25dc4cf09f95cdb0ca454fa48e879f91c36 (diff)
downloaddexon-solidity-8782508e0b2d8c5bbf6d35f5a92ed1d993edc128.tar.gz
dexon-solidity-8782508e0b2d8c5bbf6d35f5a92ed1d993edc128.tar.zst
dexon-solidity-8782508e0b2d8c5bbf6d35f5a92ed1d993edc128.zip
Update documentation about C3 linearization.
Diffstat (limited to 'docs/contracts.rst')
-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
======================================================