docs: Explain that public library functions cannot be called internally from the outside

This commit is contained in:
Kamil Śliwak 2021-03-25 18:57:13 +01:00
parent e1464fa4fb
commit 8c6bbf607f

View File

@ -38,6 +38,12 @@ To realize this in the EVM, code of internal library functions
and all functions called from therein will at compile time be included in the calling and all functions called from therein will at compile time be included in the calling
contract, and a regular ``JUMP`` call will be used instead of a ``DELEGATECALL``. contract, and a regular ``JUMP`` call will be used instead of a ``DELEGATECALL``.
.. note::
The inheritance analogy breaks down when it comes to public functions.
Calling a public library function with ``L.f()`` results in an external call (``DELEGATECALL``
to be precise).
In contrast, ``A.f()`` is an internal call when ``A`` is a base contract of the current contract.
.. index:: using for, set .. index:: using for, set
The following example illustrates how to use libraries (but using a manual method, The following example illustrates how to use libraries (but using a manual method,