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

add reserved words to the generator #13

Closed
brabalan opened this issue Nov 14, 2017 · 3 comments
Closed

add reserved words to the generator #13

brabalan opened this issue Nov 14, 2017 · 3 comments
Labels
generator Issues with the ocaml to js generator and ppx extensions

Comments

@brabalan
Copy link
Member

The generator should not accept variable names that are reserved JavaScript words.

@IgnoredAmbience
Copy link
Member

IgnoredAmbience commented Nov 14, 2017

Turns out that we already did special-case arguments, eval, and caller keywords, we just hadn't bothered completing the rest of the list.
Currently these are unsupported as identifiers in the ocaml source code. I propose to permit them, but to prefix the variable name with a $ character. We already use $ in place of ', and ocaml does not permit ' as the first character of an identifier, so we should be safe to use it as a prefix.

We may also use any Unicode character that has the ID_Continue property that is not in the ocaml identifier range ([a-zA-Z0-9] and ISO8859-1 characters 192–214, 216–246, 248–255).

@IgnoredAmbience
Copy link
Member

Fixed in 68fef4b.

@IgnoredAmbience
Copy link
Member

IgnoredAmbience commented Nov 14, 2017

If anyone has any preference for a symbol to prefix these identifiers other than 𝕍, feel free to suggest one/update the code.

@IgnoredAmbience IgnoredAmbience added the generator Issues with the ocaml to js generator and ppx extensions label Jul 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
generator Issues with the ocaml to js generator and ppx extensions
Projects
None yet
Development

No branches or pull requests

2 participants