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

Document restrictions on input, specifically identifier names #19

Open
domenic opened this issue Aug 6, 2019 · 0 comments
Open

Document restrictions on input, specifically identifier names #19

domenic opened this issue Aug 6, 2019 · 0 comments
Milestone

Comments

@domenic
Copy link
Collaborator

domenic commented Aug 6, 2019

We're starting to introduce new identifiers, specifically via imports, and depend on them. But consider the following program:

const Document_createElement = 5;
const x = document.createElement('div');

this will get transformed in to

import { createElement as Document_createElement } from "std:global/Document";
const Document_createElement = 5;
const x = call(a, Document_createElement, ['div']);

which is an error (double declaration of Document_createElement).

We could do something complicated, detecting existing bindings and routing around them (e.g. instead of the import being named Document_createElement it could be named Document_createElement1).

But that would be overkill. We should instead just make it clear up front that input code should not contain identifiers with underscores in it. We can recommend the ESLint rule which checks this, even.

If we felt that was too restrictive, we could alias everything to have some prefix (e.g. o_Document_createElement or $Document_createElement) and then document that restriction instead.

@domenic domenic added this to the Polish milestone Aug 9, 2019
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

No branches or pull requests

1 participant