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

warn if an optional parameter is always passed #486

Open
michaelficarra opened this issue Sep 23, 2022 · 5 comments
Open

warn if an optional parameter is always passed #486

michaelficarra opened this issue Sep 23, 2022 · 5 comments
Labels

Comments

@michaelficarra
Copy link
Member

This way we can mark it non-optional.

@ljharb
Copy link
Member

ljharb commented Sep 23, 2022

Perhaps also we could warn if it's never passed, so we can remove it.

@jmdyck
Copy link
Contributor

jmdyck commented Sep 12, 2023

Perhaps also we could warn if it's never passed, so we can remove it.

The current ecma262 has a few cases where an operation's optional parameter is never passed an argument:

  • CreateBuiltinFunction's _prefix_
  • LoadRequestedModules's _hostDefined_
  • DetachArrayBuffer's _key_ (but only because the spec never invokes the operation)
  • GetModifySetValueInBuffer's _isLittleEndian_

but you probably don't want to remove the parameter in the first 3 cases, and maybe in the last one too.

@michaelficarra
Copy link
Member Author

but you probably don't want to remove the parameter

I don't understand why we would want the parameter if it's never passed. We could always add it if we find a need for it.

@jmdyck
Copy link
Contributor

jmdyck commented Sep 12, 2023

You probably don't want to remove ...

  • CreateBuiltinFunction's _prefix_ because the fact that it's never passed an argument is basically a spec bug. See Editorial: Specify _prefix_ for non-specific uses of CreateBuiltinFunction ecma262#2833.
  • LoadRequestedModules's _hostDefined_ because, although the spec never passes an arg to it, HTML does.
  • DetachArrayBuffer's _key_ because it's intended to be used by "certain embedding environments, not by algorithms in this specification".

As for GetModifySetValueInBuffer's _isLittleEndian_, I'm not sure. As far as I can tell, it'd be okay to remove, but I might be missing something.

@michaelficarra
Copy link
Member Author

CreateBuiltinFunction's _prefix_

Fair.

LoadRequestedModules's _hostDefined_ and DetachArrayBuffer's _key_

If we mark integration points as such (tc39/ecma262#3147 (comment)), we can exclude these from the check.

GetModifySetValueInBuffer's _isLittleEndian_

Let's remove it: tc39/ecma262#3173

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

3 participants