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

Allow object for attribute names? #845

Open
saschanaz opened this issue Feb 25, 2020 · 5 comments
Open

Allow object for attribute names? #845

saschanaz opened this issue Feb 25, 2020 · 5 comments

Comments

@saschanaz
Copy link
Member

@gkellogg authoring JSON-LD 1.1 wants to use object as a valid attribute name. Obviously _object should work, but then object looks general enough for people to want using it without preceding underscore.

@annevk
Copy link
Member

annevk commented Feb 25, 2020

In general I'm in favor of not requiring folks to use underscores when it is possible to avoid doing so.

Is it possible to simplify some of this by for instance requiring that an interface/dictionary/enum/callback starts with a capital?

@bzbarsky
Copy link
Collaborator

I think just adding object to AttributeNameKeyword is workable. At least it does not seem to lead to any parsing ambiguities that I can find.

Doing something more generic, I'm not sure, not least in terms of how to express it to parsers.

@bathos
Copy link
Contributor

bathos commented Mar 10, 2020

@annevk I think the issue is in how the lexical grammar is defined rather than being about disambiguating top level syntactic constructs or idents within types.

If a literal teletype terminal appears anywhere in the grammar, it becomes a unique terminal which is subtracted from any pattern-based terminals that the same string would otherwise have matched. So if "object" appears as a literal terminal anywhere in the grammar, it isn’t an identifier, and to make it available as one, it has to be explicitly whitelisted as an alternative where that’s desired.

It’s an interesting lexical approach to the concept of reserved words — it simplifies some stuff, makes other things weird..

@annevk
Copy link
Member

annevk commented Mar 11, 2020

Thanks for explaining that @bathos! That helps a lot.

So https://heycam.github.io/webidl/#index-prod-Other has object as literal but also has AttributeNameKeyword. Wouldn't that create an ambiguity?

@bzbarsky
Copy link
Collaborator

We'd take the explicit "object" out of "Other" if we add it to "AttributeNameKeyword"

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

No branches or pull requests

4 participants