aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-09-14 00:35:48 +0800
committerGitHub <noreply@github.com>2017-09-14 00:35:48 +0800
commit5c9dbd50839ac153f367ce69abb10dd22877842e (patch)
tree98e3b524aaacdafb2c30feb04567159591bad562 /docs
parent3f3bcc4f8a0d12e9b92d6b63e7cfd92cbbfa775d (diff)
parent8b166c36369d0d1b39a4c537bc6ee8a08f3c6e5a (diff)
downloaddexon-solidity-5c9dbd50839ac153f367ce69abb10dd22877842e.tar.gz
dexon-solidity-5c9dbd50839ac153f367ce69abb10dd22877842e.tar.zst
dexon-solidity-5c9dbd50839ac153f367ce69abb10dd22877842e.zip
Merge pull request #2473 from ethereum/functiontype-sig
Add .selector member on function types
Diffstat (limited to 'docs')
-rw-r--r--docs/abi-spec.rst2
-rw-r--r--docs/types.rst11
2 files changed, 13 insertions, 0 deletions
diff --git a/docs/abi-spec.rst b/docs/abi-spec.rst
index fc1a3adb..3ce7f50c 100644
--- a/docs/abi-spec.rst
+++ b/docs/abi-spec.rst
@@ -17,6 +17,8 @@ We assume the interface functions of a contract are strongly typed, known at com
This specification does not address contracts whose interface is dynamic or otherwise known only at run-time. Should these cases become important they can be adequately handled as facilities built within the Ethereum ecosystem.
+.. _abi_function_selector:
+
Function Selector
=================
diff --git a/docs/types.rst b/docs/types.rst
index 3335655a..5c291f35 100644
--- a/docs/types.rst
+++ b/docs/types.rst
@@ -400,6 +400,17 @@ Note that public functions of the current contract can be used both as an
internal and as an external function. To use ``f`` as an internal function,
just use ``f``, if you want to use its external form, use ``this.f``.
+Additionally, public (or external) functions also have a special member called ``selector``,
+which returns the :ref:`ABI function selector <abi_function_selector>`::
+
+ pragma solidity ^0.4.0;
+
+ contract Selector {
+ function f() returns (bytes4) {
+ return this.f.selector;
+ }
+ }
+
Example that shows how to use internal function types::
pragma solidity ^0.4.5;