Skip to content

Idea: #define usage for functions #209

@Jofairden

Description

@Jofairden

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:

        #define voterId uint256 = voterList[_wallet]; // _wallet is a function parameter
        #define voter 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions