Zondax / filecoin-solidity

Filecoin Solidity API Library
Apache License 2.0
94 stars 43 forks source link

Code style idea: seperate usages of callBy* that send value > 0 and those with value == 0 #286

Closed snissn closed 1 year ago

snissn commented 1 year ago

As only ~3 or so instances of the CallBy methods use non zero value, there is a potential source of confusion around sending $ to the call.

Create two versions of each of the callBy* Methods that accept value and that expect value = 0. Most instances will use the value = 0 and the code should be more readable.

:link: zboto Link

emmanuelm41 commented 1 year ago

@snissn I know what you mean here, but so far we have callByID, callByAddress and callNonSingletonByID. If we add another option with = 0 and != 0, it is going to be kind of messy. I think we can sacrifice this in order to avoid more and more functions that are slightly different. I could add a constant called VALUE_ZERO and send that as value for methods that don't send anything. That could be an option.

maciejwitowski commented 1 year ago

@snissn is what you're proposing to have some callWithValueByID method? I'm not sure it's gonna be more readable. This is internal API anyway, right? We don't expect developers to be using these methods directly.

snissn commented 1 year ago

yes - this helps with long term code maintainability to prevent future development from problems, but is not needed for this release

emmanuelm41 commented 1 year ago

We will end up with a long combination of functions that do almost the same though.

snissn commented 1 year ago

i'm happy to close this one