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

'toString' is supposed to be a valid operation argument name #785

Open
nektro opened this issue Jun 28, 2024 · 3 comments
Open

'toString' is supposed to be a valid operation argument name #785

nektro opened this issue Jun 28, 2024 · 3 comments
Labels

Comments

@nektro
Copy link

nektro commented Jun 28, 2024

Under https://webidl.spec.whatwg.org/#idl-names

The identifier of any of the abovementioned IDL constructs (except operation arguments) must not be "constructor", "toString", or begin with a U+005F (_). These are known as reserved identifiers.

this is to have users use Constructor and Stringifier respectively.

however, taking note of the exception, it appears the following code should pass even though today it fails the checker:

[Exposed]
interface Foo {
  undefined foo(int toString);
};
WebIDLParseError: Syntax error at line 3:
  undefined foo(int toString
                    ^ toString is a reserved identifier and must not be used.
@saschanaz
Copy link
Member

Ah "(except operation arguments)". Thanks for reporting.

@nektro
Copy link
Author

nektro commented Jun 28, 2024

fwiw i prefer the checker's current behavior, but since it currently disagrees with the spec as-written I wanted to have a paper trail. currently searching to see if i can find the historical reason that exception was originally added.

@nektro
Copy link
Author

nektro commented Jun 28, 2024

did some more playing around. i rescind the previous comment.

@saschanaz saschanaz added the bug label Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants