solidity-ide icon indicating copy to clipboard operation
solidity-ide copied to clipboard

[Language] functions as parameters

Open flantony opened this issue 7 years ago • 0 comments

The following example is valid code, that should result in a single compiler warning "Naming function type return parameters is deprecated.". We currently don't support functions as parameter

pragma solidity ^0.4.18;

contract test{
    function reduce(uint[] memory self, function (uint x, uint y) returns (uint) f) internal returns (uint r)
    {
        r = self[0];
        for (uint i = 1; i < self.length; i++) {
            r = f(r, self[i]);
        }
    }
  }

flantony avatar Nov 28 '17 08:11 flantony