-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Allow reserved words as record names w/out quotes #7873
Draft
choptastic
wants to merge
7
commits into
erlang:master
Choose a base branch
from
choptastic:reserved_word_records
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Commits on Sep 11, 2024
-
Allow reserved words as record names w/out quotes
This motivation for this comes from the Nitrogen Web Frameworks's heavy use of records, and a clash between HTML <div> element and the Erlang div operator. In Nitrogen, HTML elements are represented by Erlang records. For example: the HTML `<span>` element is `#span{}` in Nitrogen. Logically, the heavily-used HTML `<div>` element would be represented by `#div{}` in Nitrogen, however, that specific syntax is illegal due to `div`'s reserved word status, and must instead be represented with `#'div'`. This syntax, however, is awkward, and has led to a workaround that *works*, but is itself awkward (using the term `#panel{}` instead of `#div{}` - but this in itself leads to a semantic clash, as some frontend HTML frameworks have their own 'panel' elements that might ideally be abstracted into a `#panel{}` element. But, As far as I understand, there is no potential syntax clash in allowing the syntax `#div` ito be acceptable, and have the parser recognize that the `div` (or any reserved word) in that `context` can only be an atom, and would never be an operator. So this change tweaks the grammar to recognize the circumstances of: `#reserved_word{}`. Further, this change does not change the way the records are defined (so the definition must still be defined with the atom properly wrapped in quotes (e.g. `-record('div', {a,b}).`). This PR also adds the appropriate tests in `erl_expand_records_SUITE`, which I wasn't sure if that was appropriate place, but it seemed the most relevant.
Configuration menu - View commit details
-
Copy full SHA for 06262ae - Browse repository at this point
Copy the full SHA 06262aeView commit details -
Configuration menu - View commit details
-
Copy full SHA for dde9f78 - Browse repository at this point
Copy the full SHA dde9f78View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2b0e1ca - Browse repository at this point
Copy the full SHA 2b0e1caView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7af6208 - Browse repository at this point
Copy the full SHA 7af6208View commit details -
Configuration menu - View commit details
-
Copy full SHA for d9429e7 - Browse repository at this point
Copy the full SHA d9429e7View commit details
Commits on Sep 13, 2024
-
Configuration menu - View commit details
-
Copy full SHA for f45d691 - Browse repository at this point
Copy the full SHA f45d691View commit details
Commits on Sep 16, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 539299e - Browse repository at this point
Copy the full SHA 539299eView commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.