You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The calling context remains the contract the function is defined in. Using my-some-func would be equivalent to substituting it with contract-call?. (It is a call, not a delegate call.)
use-function, like use-trait, can only be used top-level.
The upsides:
All contracts for which use-function is used are cached so the external function will be cheaper to call iteratively compared to a series of contract-call?. It is an alternative solution for the issue described in Support caching model #94. Bound by all the same runtime dimensions.
Much easier to create library contracts that add functionality.
Better composability, don't need to repeat contract-call? nor create a local wrapper function.
I suggest the introduction of a new top-level built-in like
use-trait.The
use-functionbuilt-in is used to import and alias a function of another contract.contract-a:
contract-b:
The calling context remains the contract the function is defined in. Using
my-some-funcwould be equivalent to substituting it withcontract-call?. (It is a call, not a delegate call.)use-function, likeuse-trait, can only be used top-level.The upsides:
use-functionis used are cached so the external function will be cheaper to call iteratively compared to a series ofcontract-call?. It is an alternative solution for the issue described in Support caching model #94. Bound by all the same runtime dimensions.contract-call?nor create a local wrapper function.Edit: related to #11.