mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Document gas/value modifiers with overloading
This commit is contained in:
parent
f787ecae5a
commit
8e1aae2e1a
@ -441,16 +441,6 @@ The correct way to do this is the following::
|
||||
}
|
||||
}
|
||||
|
||||
Is it possible to send a value while calling an overloaded function?
|
||||
====================================================================
|
||||
|
||||
It's a known missing feature. https://www.pivotaltracker.com/story/show/92020468
|
||||
as part of https://www.pivotaltracker.com/n/projects/1189488
|
||||
|
||||
Best solution currently see is to introduce a special case for gas and value and
|
||||
just re-check whether they are present at the point of overload resolution.
|
||||
|
||||
|
||||
******************
|
||||
Advanced Questions
|
||||
******************
|
||||
|
@ -139,6 +139,12 @@ Lastly, these modifiers can be combined. Their order does not matter::
|
||||
|
||||
nameReg.call.gas(1000000).value(1 ether)("register", "MyName");
|
||||
|
||||
.. note::
|
||||
It is not yet possible to use the gas or value modifiers on overloaded functions.
|
||||
|
||||
A workaround is to introduce a special case for gas and value and just re-check
|
||||
whether they are present at the point of overload resolution.
|
||||
|
||||
In a similar way, the function ``delegatecall`` can be used: the difference is that only the code of the given address is used, all other aspects (storage, balance, ...) are taken from the current contract. The purpose of ``delegatecall`` is to use library code which is stored in another contract. The user has to ensure that the layout of storage in both contracts is suitable for delegatecall to be used. Prior to homestead, only a limited variant called ``callcode`` was available that did not provide access to the original ``msg.sender`` and ``msg.value`` values.
|
||||
|
||||
All three functions ``call``, ``delegatecall`` and ``callcode`` are very low-level functions and should only be used as a *last resort* as they break the type-safety of Solidity.
|
||||
|
Loading…
Reference in New Issue
Block a user