Don’t see this feature as a reason for people to neglect good API choices; see its use as a signal that you should rethink your API, and if there’s no other way, it’s okay to use it as a last resort.
I left the advantages listed in the gist above, but I’ll mention them here:
- Suggesting improvements for APIs often takes a long time to be accepted, and even then there’s a chance they’ll be rejected, making the process even more time-consuming;
- You are no longer required to create temporary variables in order to avoid losing the reference;
- Avoid creating custom utilities or subclasses to work around the problem.
- It can serve as a metric to indicate a poor API;
- You are not dependent on API maintainers because it works with any method; ~ @jsbueno
- It is moderately readable and intuitive, much more so than solutions with
:=+or, and much more concise. - Since the API remains unchanged, it does not break compatibility with previous versions; ~ @jsbueno
- More incentive for creating methods that modify only the class state, so they can focus solely on functionality; ~ @jsbueno