From 1e5c229a37ef91784552e776707e40bd9e2aedd4 Mon Sep 17 00:00:00 2001 From: andy53 Date: Tue, 25 Oct 2022 20:15:18 -0600 Subject: [PATCH] update value-types.rst --- docs/types/value-types.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/types/value-types.rst b/docs/types/value-types.rst index cfec894a9..8048eea58 100644 --- a/docs/types/value-types.rst +++ b/docs/types/value-types.rst @@ -770,6 +770,16 @@ confusing, but in essence, if a function is ``payable``, this means that it also accepts a payment of zero Ether, so it also is ``non-payable``. On the other hand, a ``non-payable`` function will reject Ether sent to it, so ``non-payable`` functions cannot be converted to ``payable`` functions. +To clarify, rejecting ether is more restrictive than not rejecting ether. +This means you can override a payable function with a non-payable but not the +other way around. + +Additionally, When you define a ``non-payable`` function pointer, +the compiler does not enforce that the pointed function will actually reject ether. +Instead, it enforces that the function pointer is never used to send ether. +Which makes it possible to assign a ``payable`` function pointer to a ``non-payable`` +function pointer ensuring both types behave the same way, i.e, both cannot be used +to send ether. If a function type variable is not initialised, calling it results in a :ref:`Panic error`. The same happens if you call a function after using ``delete``