diff options
author | chriseth <c@ethdev.com> | 2016-11-08 18:43:42 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-11-16 21:37:18 +0800 |
commit | 0e5507c78c5b1602ff0f9e5530ab05f0a35ecc0d (patch) | |
tree | f7b3709ba59fedcdda5a2d011c8af51180943c91 /docs | |
parent | 47794c1da406a28f0e8a10e3e57cd935f5cc7f3d (diff) | |
download | dexon-solidity-0e5507c78c5b1602ff0f9e5530ab05f0a35ecc0d.tar.gz dexon-solidity-0e5507c78c5b1602ff0f9e5530ab05f0a35ecc0d.tar.zst dexon-solidity-0e5507c78c5b1602ff0f9e5530ab05f0a35ecc0d.zip |
Updates to the documentation.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/types.rst | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/docs/types.rst b/docs/types.rst index cac8b774..1673c30d 100644 --- a/docs/types.rst +++ b/docs/types.rst @@ -274,14 +274,16 @@ check the value ranges at runtime and a failure causes an exception. Enums need Function Types -------------- -Functions can be assigned to variables and passed on together with function calls. -These types come in two flavours: *internal* and *external* functions. +Function types can be used to assign functions to variables and passing them +to or return them from function calls. Such variables and parameters have +to have function types. These types come in two flavours: *internal* and *external* +functions. Internal functions can only be used inside the current contract (more specifically, -inside the current code unit, which also includes internal library functions) -because they cannot be executed outside of the -context of the current function. Calling an internal function is realized -by jumping to its entry label, just like when calling an function of the current +inside the current code unit, which also includes internal library functions +and inherited functions) because they cannot be executed outside of the +context of the current contract. Calling an internal function is realized +by jumping to its entry label, just like when calling a function of the current contract internally. External functions consist of an address and a function signature and they can @@ -289,9 +291,11 @@ be passed via and returned from external function calls. Function types are notated as follows: - function (<argument types>) internal / external returns (<return types>) + function (<parameter types>) {internal|external} [constant] [returns (<return types>)] -As always, the ``returns (<return types>)`` is optional. +In contrast to the parameter types, the return types cannot be empty - if the +function type should not return anything, the whole ``returns (<return types>)`` +part has to be omitted. By default, function types are internal, so the ``internal`` keyword can be omitted. |