Skip to content

Conversation

KristofferC
Copy link
Member

I hit this error message and it felt someone was very angry at me 😢

@KristofferC KristofferC added the error messages Better, more actionable error messages label Jul 5, 2024
macro main(args...)
if !isempty(args)
error("USAGE: `@main` is expected to be used as `(@main)` without macro arguments.")
error("`@main` is expected to be used as `(@main)` without macro arguments.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the interest of taking advantage of semantic errors, can this throw(ArgumentError(..)) instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what errors one typically throws in macro expansions. I'll just do the current change for now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not really consistent across Base at the moment. When I reworked the error messages in Printf, I opted for ArgumentError because the error is about the arguments of a macro (see here). I guess this could change in the future though if/when macros get the fancy error messages Claire talked about at JuliaCon. I'll keep this in mind until then though.

@KristofferC KristofferC merged commit 2a8bdd0 into master Jul 12, 2024
@KristofferC KristofferC deleted the kc/USAGE branch July 12, 2024 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

error messages Better, more actionable error messages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants