Hello everyone! this is my first time posting to this community, so please
excuse me if I get any part of the netiquette wrong.
Recently I’ve been working on a linter
rule to
disallow use of positional arguments when a function has more than a few
parameters, requiring usage of named parameters instead.
However, I realized that currently Solidity doesn’t consider the parameter names
part of the interface definition (which of course makes sense from an ABI point
of view), but it can be confusing when using named parameters to invoke
functions. Let me illustrate:
given an interface
interface IFoo {
function foo(uint256 a, uint256 b) external returns (uint256);
}
it should not be a valid override to use different names for the parameters.
Valid:
contract Foo is IFoo {
function foo(uint256 a, uint256 b) external returns (uint256);
}
Currently valid, proposed invalid:
contract Foo is IFoo {
function foo(uint256 other, uint256 name) external returns (uint256);
}
Allowing the latter causes confusion when using named parameters to invoke
functions, since types implementing the same interface would have different ways
of invoking the same function
I created a small repo with an example of this behaviour:
What do you think?