In the spirit of recent discussion about simplifying macros and making errors more clear, I started looking back into where we have existing complications. For instance in https://github.com/luckyframework/lucky/pull/1372 we added a new method with a compiler error to help people avoid confusion when using Lucky::Action.route. We are still seeing people get confused about it, so I went to see if I could help make it even better. I started looking into moving the method and was about to make a PR with it and decided just to double check, to run the error without the overload to get a screenshot of the default error message and show how my change made it "better". I was totally surprised to find out that the default error was WAY better than what we have.
The Caveat
The problem is... the better default error message only appears if we remove Lucky::Action.with. If it's not taken out, the error message is still confusing.
Example
This is the line with the error ("foo" shouldn't be there but technically it's duplicated arguments since no_default is the first argument)
Current Without custom `Lucky::Action.route` compiler error Without `Lucky::Action.with`
There's multiple other ways to trigger a compilation error and all of them are clearly pointing at the correct line instead of within macro code. But are we willing to accept the cost? DUN-DUN-DUUUUN!!!
In the spirit of recent discussion about simplifying macros and making errors more clear, I started looking back into where we have existing complications. For instance in https://github.com/luckyframework/lucky/pull/1372 we added a new method with a compiler error to help people avoid confusion when using
Lucky::Action.route
. We are still seeing people get confused about it, so I went to see if I could help make it even better. I started looking into moving the method and was about to make a PR with it and decided just to double check, to run the error without the overload to get a screenshot of the default error message and show how my change made it "better". I was totally surprised to find out that the default error was WAY better than what we have.The Caveat
The problem is... the better default error message only appears if we remove
Lucky::Action.with
. If it's not taken out, the error message is still confusing.Example
This is the line with the error ("foo" shouldn't be there but technically it's duplicated arguments since
no_default
is the first argument)Specifying default incorrectly
Current
Without custom `Lucky::Action.route` compiler error
Without `Lucky::Action.with`
There's multiple other ways to trigger a compilation error and all of them are clearly pointing at the correct line instead of within macro code. But are we willing to accept the cost? DUN-DUN-DUUUUN!!!