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

Purpose of call-a-user-object’s-operation’s opName parameter #1282

Open
bathos opened this issue Mar 17, 2023 · 3 comments
Open

Purpose of call-a-user-object’s-operation’s opName parameter #1282

bathos opened this issue Mar 17, 2023 · 3 comments

Comments

@bathos
Copy link
Contributor

bathos commented Mar 17, 2023

Callback interfaces are required to have one-and-only-one regular operation*. The single operation has a particular known name. However call a user object’s operation requires an opName parameter. This permits the algorithm to be invoked with a different name than was given in the callback interface definition for the type that value is an instance of.

The only usages of the algorithm I could find are in the DOM spec, which always passes an opName that does align with the name of the CBI’s operation member. Is there any reason for this parameter to exist given it’s a static part of the type definition? It seems likely that it’s unintentional that it permits passing a different name.

* Which isn’t really an operation in the same sense that word is used elsewhere in the spec; it just uses the same syntax.

@domenic
Copy link
Member

domenic commented Mar 19, 2023

Agreed, this seems like a mistake!

@annevk
Copy link
Member

annevk commented Mar 20, 2023

As per https://dontcallmedom.github.io/webidlpedia/names/ all callback interfaces are indeed in DOM and follow this pattern. So this could be simplified.

@bathos
Copy link
Contributor Author

bathos commented Apr 17, 2023

Found more context for this: callback interfaces were permitted to have multiple operation members (and attributes) prior to #696, which removed these capabilities because they weren’t really in use. The opName parameter is a relic from before that update.

I also found an implementation relic of this in Blink, where callback interfaces can be kNotSingleOperation (but never actually are).

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

3 participants