3 ms·
PHP got this property in PHP 8. One problem with this approach is refactoring. If you wanted to refactor your example with the parameter "amount_in_dollars" th
by dotancohen 5y ago
PHP got this property in PHP 8.
One problem with this approach is refactoring. If you wanted to refactor your example with the parameter "amount_in_dollars" then you would either have to continue maintaining the legacy "amount" argument, or break existing code.
- necovek 5y agoSo you mean just like with, eg. renaming a function? I agree it's an issue compared to not doing it, but a very, very minor one IMHO, and legibility improvements far outweight it.
- dotancohen 5y agoRenaming a function comes with the explicit implication that the API has changed. But it might not be clear to someone maintaining a Python application that changing a parameter name might change an argument - that is not the case in any other language (until PHP 8). Guess how I discovered this issue :)
- necovek 5y agoWell, if the approach was more pervasive, you'd be used to it just like seasoned Python developers are. :)