mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Document function selectors
This commit is contained in:
parent
fd1f8ab38b
commit
c70ebfd241
@ -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
|
||||
=================
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user