Make function application left associative so it can be chained
A point where Erlang has always broken the Principle of Least Astonishment is in function application. You would typically expect (particularly in a functional language) that if a function call returns another function, you can apply it directly by appending another set of arguments within parentheses, but in Erlang, you are also forced to put the first function call within an extra parenthesis, like so: (f(X))(Y), rather than the expected f(X)(Y). For example, (accessor(Path))(Thing). This can get tiresome when you're working with higher order functions, and sometimes actually obscures the fact that a function application is happening, due to the extra parentheses acting as camouflage.
The fix is easy, and since it has not been allowed before there is no existing code where this would change the meaning. It however required me to slightly refactor the remote_expr part of the grammar to fix conflicts. It turned out this could also easily be relaxed, so that you can write get_callback_module(State):callbackFunc(...) instead of the current (get_callback_module(State)):callbackFunc(...).
CT Test Results
3 files 419 suites 1h 13m 19s ⏱️ 2 936 tests 2 886 ✅ 50 💤 0 ❌ 8 126 runs 8 070 ✅ 56 💤 0 ❌
Results for commit 9af30eec.
:recycle: This comment has been updated with latest results.
To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass.
See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally.
Artifacts
- Complete CT logs (Download Logs)
- HTML Documentation (Download HTML Docs)
- No Windows Installer found
// Erlang/OTP Github Action Bot
hi @richcarl , could you include some tests? Thanks
Thanks! Added to our daily builds.