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
Currently #define annotations are quite limited, being only applicable at the contract level.
It would be nice to be able to use a #define, rather than supplying a function, simply replacing the code inside other annotations.
Example:
#definevoterId uint256 = voterList[_wallet]; // _wallet is a function parameter
#definevoter Voter = listOfVoters[voterId];
#if_succeeds "registered the update"
voter.isActive == _isActive;
Would be translated into
#if_succeeds "registered the update"
listOfVoters[voterList[_wallet]].isActive == _isActive;
This would give #define a second purpose for functions and help clean up annotations.
The text was updated successfully, but these errors were encountered:
Thank you for the suggestion. This is a neat idea. We currently have a #let var := some expression; annotation that can be used inside of a function like a normal local variable. Would you be ok if instead of the #define keyword, we re-used the #let keyword at the function level as well? Honestly I am not sure which is the better option. Just wondering.
@cd1m0 I am not up to speed on the interface design of this library, but my thought is that a 'definition' (define) is more clear because it indicates that the user would define X to be Y. In the case of let, it might initially appear to be or behave as a variable.
Currently
#define
annotations are quite limited, being only applicable at the contract level.It would be nice to be able to use a
#define
, rather than supplying a function, simply replacing the code inside other annotations.Example:
Would be translated into
#if_succeeds "registered the update" listOfVoters[voterList[_wallet]].isActive == _isActive;
This would give
#define
a second purpose for functions and help clean up annotations.The text was updated successfully, but these errors were encountered: