diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-02-03 07:52:34 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-02-03 08:17:21 +0800 |
commit | ace583d0a1ec21cc184fb5734a9fd8c2147391e4 (patch) | |
tree | b05291501171ac29b1b4910ecb4ba55dcb999c23 | |
parent | bea59b0ca7fd497baf82e5960649854dff268d8a (diff) | |
download | dexon-solidity-ace583d0a1ec21cc184fb5734a9fd8c2147391e4.tar dexon-solidity-ace583d0a1ec21cc184fb5734a9fd8c2147391e4.tar.gz dexon-solidity-ace583d0a1ec21cc184fb5734a9fd8c2147391e4.tar.bz2 dexon-solidity-ace583d0a1ec21cc184fb5734a9fd8c2147391e4.tar.lz dexon-solidity-ace583d0a1ec21cc184fb5734a9fd8c2147391e4.tar.xz dexon-solidity-ace583d0a1ec21cc184fb5734a9fd8c2147391e4.tar.zst dexon-solidity-ace583d0a1ec21cc184fb5734a9fd8c2147391e4.zip |
Rename accessor to getter
-rw-r--r-- | docs/contracts.rst | 24 | ||||
-rw-r--r-- | docs/control-structures.rst | 2 | ||||
-rw-r--r-- | docs/frequently-asked-questions.rst | 2 | ||||
-rw-r--r-- | docs/introduction-to-smart-contracts.rst | 2 | ||||
-rw-r--r-- | docs/miscellaneous.rst | 4 | ||||
-rw-r--r-- | docs/structure-of-a-contract.rst | 4 | ||||
-rw-r--r-- | docs/types.rst | 10 |
7 files changed, 24 insertions, 24 deletions
diff --git a/docs/contracts.rst b/docs/contracts.rst index edc42c3d..1516ba0b 100644 --- a/docs/contracts.rst +++ b/docs/contracts.rst @@ -145,11 +145,11 @@ This means that cyclic creation dependencies are impossible. .. index:: ! visibility, external, public, private, internal -.. _visibility-and-accessors: +.. _visibility-and-getters: -************************ -Visibility and Accessors -************************ +********************** +Visibility and Getters +********************** Since Solidity knows two kinds of function calls (internal ones that do not create an actual EVM call (also called @@ -173,7 +173,7 @@ and the default is ``internal``. ``public``: Public functions are part of the contract interface and can be either called internally or via - messages. For public state variables, an automatic accessor + messages. For public state variables, an automatic getter function (see below) is generated. ``internal``: @@ -243,12 +243,12 @@ In the following example, ``D``, can call ``c.getData()`` to retrieve the value } } -.. index:: ! accessor;function, ! function;accessor +.. index:: ! getter;function, ! function;getter -Accessor Functions -================== +Getter Functions +================ -The compiler automatically creates accessor functions for +The compiler automatically creates getter functions for all **public** state variables. For the contract given below, the compiler will generate a function called ``data`` that does not take any arguments and returns a ``uint``, the value of the state @@ -271,7 +271,7 @@ be done at declaration. } } -The accessor functions have external visibility. If the +The getter functions have external visibility. If the symbol is accessed internally (i.e. without ``this.``), it is evaluated as a state variable and if it is accessed externally (i.e. with ``this.``), it is evaluated as a function. @@ -462,7 +462,7 @@ Functions can be declared constant. These functions promise not to modify the st } .. note:: - Accessor methods are marked constant. + Getter methods are marked constant. .. warning:: The compiler does not enforce yet that a constant method is not modifying state. @@ -882,7 +882,7 @@ Inheriting Different Kinds of Members of the Same Name When the inheritance results in a contract with a function and a modifier of the same name, it is considered as an error. This error is produced also by an event and a modifier of the same name, and a function and an event of the same name. -As an exception, a state variable accessor can override a public function. +As an exception, a state variable getter can override a public function. .. index:: ! contract;abstract, ! abstract contract diff --git a/docs/control-structures.rst b/docs/control-structures.rst index 757988cc..1c7d71f2 100644 --- a/docs/control-structures.rst +++ b/docs/control-structures.rst @@ -393,7 +393,7 @@ Currently, Solidity automatically generates a runtime exception in the following #. If you convert a value too big or negative into an enum type. #. If you perform an external function call targeting a contract that contains no code. #. If your contract receives Ether via a public function without ``payable`` modifier (including the constructor and the fallback function). -#. If your contract receives Ether via a public accessor function. +#. If your contract receives Ether via a public getter function. #. If you call a zero-initialized variable of internal function type. Internally, Solidity performs an "invalid jump" when a user-provided exception is thrown. In contrast, it performs an invalid operation diff --git a/docs/frequently-asked-questions.rst b/docs/frequently-asked-questions.rst index 43fba332..d2fc5b1c 100644 --- a/docs/frequently-asked-questions.rst +++ b/docs/frequently-asked-questions.rst @@ -641,7 +641,7 @@ Not yet, as this requires two levels of dynamic arrays (``string`` is a dynamic If you issue a call for an array, it is possible to retrieve the whole array? Or must you write a helper function for that? =========================================================================================================================== -The automatic accessor function for a public state variable of array type only returns +The automatic getter function for a public state variable of array type only returns individual elements. If you want to return the complete array, you have to manually write a function to do that. diff --git a/docs/introduction-to-smart-contracts.rst b/docs/introduction-to-smart-contracts.rst index 524cbcb0..f02447cf 100644 --- a/docs/introduction-to-smart-contracts.rst +++ b/docs/introduction-to-smart-contracts.rst @@ -131,7 +131,7 @@ too far, though, as it is neither possible to obtain a list of all keys of a mapping, nor a list of all values. So either keep in mind (or better, keep a list or use a more advanced data type) what you added to the mapping or use it in a context where this is not needed, -like this one. The accessor function created by the ``public`` keyword +like this one. The getter function created by the ``public`` keyword is a bit more complex in this case. It roughly looks like the following:: diff --git a/docs/miscellaneous.rst b/docs/miscellaneous.rst index 378c3c96..c5a0262f 100644 --- a/docs/miscellaneous.rst +++ b/docs/miscellaneous.rst @@ -427,7 +427,7 @@ Tips and Tricks * Use ``delete`` on arrays to delete all its elements. * Use shorter types for struct elements and sort them such that short types are grouped together. This can lower the gas costs as multiple SSTORE operations might be combined into a single (SSTORE costs 5000 or 20000 gas, so this is what you want to optimise). Use the gas price estimator (with optimiser enabled) to check! -* Make your state variables public - the compiler will create :ref:`getters <visibility-and-accessors>` for you for free. +* Make your state variables public - the compiler will create :ref:`getters <visibility-and-getters>` for you for free. * If you end up checking conditions on input or state a lot at the beginning of your functions, try using :ref:`modifiers`. * If your contract has a function called ``send`` but you want to use the built-in send-function, use ``address(contractVariable).send(amount)``. * Initialise storage structs with a single assignment: ``x = MyStruct({a: 1, b: 2});`` @@ -541,7 +541,7 @@ Function Visibility Specifiers return true; } -- ``public``: visible externally and internally (creates accessor function for storage/state variables) +- ``public``: visible externally and internally (creates getter function for storage/state variables) - ``private``: only visible in the current contract - ``external``: only visible externally (only for functions) - i.e. can only be message-called (via ``this.func``) - ``internal``: only visible internally diff --git a/docs/structure-of-a-contract.rst b/docs/structure-of-a-contract.rst index c7af0c8c..24ef69a6 100644 --- a/docs/structure-of-a-contract.rst +++ b/docs/structure-of-a-contract.rst @@ -28,7 +28,7 @@ State variables are values which are permanently stored in contract storage. } See the :ref:`types` section for valid state variable types and -:ref:`visibility-and-accessors` for possible choices for +:ref:`visibility-and-getters` for possible choices for visibility. .. _structure-functions: @@ -49,7 +49,7 @@ Functions are the executable units of code within a contract. } :ref:`function-calls` can happen internally or externally -and have different levels of visibility (:ref:`visibility-and-accessors`) +and have different levels of visibility (:ref:`visibility-and-getters`) towards other contracts. .. _structure-function-modifiers: diff --git a/docs/types.rst b/docs/types.rst index 3fb1db95..69c23e6e 100644 --- a/docs/types.rst +++ b/docs/types.rst @@ -543,8 +543,8 @@ So ``bytes`` should always be preferred over ``byte[]`` because it is cheaper. that you are accessing the low-level bytes of the UTF-8 representation, and not the individual characters! -It is possible to mark arrays ``public`` and have Solidity create an accessor. -The numeric index will become a required parameter for the accessor. +It is possible to mark arrays ``public`` and have Solidity create a getter. +The numeric index will become a required parameter for the getter. .. index:: ! array;allocating, new @@ -792,11 +792,11 @@ Because of this, mappings do not have a length or a concept of a key or value be Mappings are only allowed for state variables (or as storage reference types in internal functions). -It is possible to mark mappings ``public`` and have Solidity create an accessor. -The ``_KeyType`` will become a required parameter for the accessor and it will +It is possible to mark mappings ``public`` and have Solidity create a getter. +The ``_KeyType`` will become a required parameter for the getter and it will return ``_ValueType``. -The ``_ValueType`` can be a mapping too. The accessor will have one parameter +The ``_ValueType`` can be a mapping too. The getter will have one parameter for each ``_KeyType``, recursively. :: |