solidity icon indicating copy to clipboard operation
solidity copied to clipboard

Remove `send` (or, other options)

Open greenlucid opened this issue 7 months ago • 1 comments

send is in a limbo state. It's available, the compiler warns against using it, and there's no way to stop the warning.

From this post I assume the Solidity philosophy is that warnings cannot be hidden because they should be obeyed at most.

Is there still no // @ts-ignore equivalent for Solidity?

I want to stop getting this warning polluting my output and linting:

"Failure condition of 'send' ignored. Consider using 'transfer' instead."

This error is useless to me, I'm using send deliberately. If you think send should NOT be used and that's why a warning is always printed, then send SHOULD be removed from the compiler, not be held in a limbo in which using it forces a warning onto all developers. Post that @0xferit wrote on this back in 2021:

https://forum.soliditylang.org/t/which-compiler-warnings-do-you-ignore/89/4

But of course, send is useful sometimes, example:

https://github.com/kleros/tcr/blob/72e547ea135d839dc5db34e79e9f94f05c6a92bb/contracts/LightGeneralizedTCR.sol#L659

If this had used transfer instead, a malicious Contract that had the role of the requester that reverts upon receiving value, could be used to prevent the Request from being Ruled.

The recommended pattern in here could be used instead: https://docs.soliditylang.org/en/v0.8.29/common-patterns.html but it would increase the complexity of the contract, so a deliberate decision was made to assume that it is the users' responsibility to accept the ETH.

If you want people to use something like recipient.call{value: deposit, gas: 2300}("");, then the procedure should be to remove send as a function, print a warning/suggestion with the call pattern above. So send can finally die in peace and we no longer have to see this warning ever again.

Or alternatively you could just add the // @ts-ignore equivalent to Solidity.

greenlucid avatar Apr 18 '25 12:04 greenlucid

May I take on it?

nadtech-hub avatar May 15 '25 17:05 nadtech-hub