Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Required parentheses for some source code attributes #9502

Open
RaimoNiskanen opened this issue Feb 26, 2025 · 0 comments
Open

Required parentheses for some source code attributes #9502

RaimoNiskanen opened this issue Feb 26, 2025 · 0 comments
Assignees
Labels
enhancement team:VM Assigned to OTP team VM

Comments

@RaimoNiskanen
Copy link
Contributor

Is your feature request related to a problem? Please describe.

In Erlang source code, for example, the -module attribute requires parenthese, but the -moduledoc does not. So you can write:

-module(foo).
-moduledoc false.

But not

-module foo.
-moduledoc false.

In fact, most attributes does not require parentheses, but the ones processed by the preprocessor does.

In this case, when using -module foo. the compilation succeeds, but there is no ?MODULE macro available in the source code, which you have when using -module(foo).

This is an annoying inconsistency, and I think in my first example that it is easier to read without the parentheses.

Describe the solution you'd like

Make the preprocessor not require parentheses around attributes, so it behaves consistently with respect to the parser.

Describe alternatives you've considered

We could live on with this ugliness, but many new attributes are by convenience not written with parentheses, such as -moduledoc false., -doc "Documentation"., etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement team:VM Assigned to OTP team VM
Projects
None yet
Development

No branches or pull requests

2 participants