Skip to content

Support 'raw identifier' syntax (new version)#12323

Merged
gasche merged 4 commits into
ocaml:trunkfrom
OlivierNicole:stedolan-raw-idents
Jun 24, 2023
Merged

Support 'raw identifier' syntax (new version)#12323
gasche merged 4 commits into
ocaml:trunkfrom
OlivierNicole:stedolan-raw-idents

Conversation

@OlivierNicole

Copy link
Copy Markdown
Contributor

This is a resubmit of @stedolan’s PR #11252. I rebased it on trunk and took into account @gasche’s comments on the original PR. Below is the original PR message.

This PR implements part of ocaml/RFCs#27 by adding support for 'raw identifiers' \#foo. The syntax \#foo means the same thing as foo, but is always an identifier even when foo is a keyword. This allows future versions of the language to introduce new keywords in a backwards-compatible way (see the RFC for full details).

The important part of this patch is the small patch to lexer.mll which adds the new concrete syntax. The entire rest of the patch is changes to various pretty-printers, to ensure that keywords are printed in appropriately escaped form should they ever occur as variable names, in types, in error messages, and the like.

@gasche gasche left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! I think that the implementation is now in a good shape. There are some minor things that feel a bit not-just-right, but this could take ages and it is in a part of the codebase that is already in a partly-inconsistent state, so we cannot hope for a perfect result. I propose to be productive by declaring victory and merging. It is a nice feature, designed for compatibility: the sooner the better.

Comment thread Changes Outdated
@gasche gasche merged commit 76a2ac4 into ocaml:trunk Jun 24, 2023
@OlivierNicole OlivierNicole deleted the stedolan-raw-idents branch June 24, 2023 16:56
@gasche gasche mentioned this pull request Jul 25, 2023
@OlivierNicole

Copy link
Copy Markdown
Contributor Author

Is this considered for inclusion into 5.2? Asking more out of curiosity than anything else.

@jmid

jmid commented Jan 18, 2024

Copy link
Copy Markdown
Member

@OlivierNicole

Copy link
Copy Markdown
Contributor Author

@shindere

shindere commented Jan 18, 2024 via email

Copy link
Copy Markdown
Contributor

@OlivierNicole

Copy link
Copy Markdown
Contributor Author

Thank you for the explanation.

@Octachron

Octachron commented Jan 19, 2024

Copy link
Copy Markdown
Member

More precisely, we (I?) are mostly using the milestones for PRs and issues that are on the fence in term of inclusion in the milestoned OCaml version in order to be sure to track their status during the various stages of the release process.

Consequently, items that are merged in the middle of the release cycle don't appear in the milestone but only in the Changes file.

@gasche

gasche commented Apr 14, 2025

Copy link
Copy Markdown
Member

Is this feature documented in the manual somewhere? I went for the "Language extensions" chapter and for the "Lexical conventions" subchapter and did not find it mentioned anywhere.

@OlivierNicole

Copy link
Copy Markdown
Contributor Author

It doesn’t seem to be.

I’ll add on my todo-list to add some docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants