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

Editorial: Rename predicate function parameter of Array methods #1782

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

shvaikalesh
Copy link
Member

@shvaikalesh shvaikalesh commented Nov 14, 2019

This change makes naming more descriptive and consistent with Array.prototype.find and Array.prototype.findIndex.

b662dff is a follow-up of #1411.
See also #1786.

@bakkot
Copy link
Contributor

bakkot commented Nov 14, 2019

A lot of these names make it into documentation; I am a little hesitant to change them.

Copy link
Member

@devsnek devsnek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like this change

@ljharb
Copy link
Member

ljharb commented Nov 14, 2019

I am highly concerned about the documentation and polyfill churn this change will cause.

@shvaikalesh
Copy link
Member Author

I've checked MDN: for Array methods, first function parameter is always a callback (even for newer find and findIndex). Is there a docs that precisely follow the names in spec?

@bakkot
Copy link
Contributor

bakkot commented Nov 14, 2019

TypeScript's typedefs, for example, which I believe are used for integration in some editors (and which therefore surface these names to users of those editors).

@devsnek
Copy link
Member

devsnek commented Nov 14, 2019

what happens if those names change or don't change?

@mathiasbynens
Copy link
Member

I’ve always considered the parameter names used in the spec to be implementation details (of the spec), similar to how the names of variables in spec algorithm steps are implementation details. Documentation can use any names whatsoever.

@michaelficarra
Copy link
Member

I like it. My only concern would be on another spec having a normative reference to one of these names, such as by specifying a change/insertion of algorithm steps that refer to the name. But barring somebody providing an example of this dependency, I'm in favour of the change.

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Jun 18, 2020

We might just change it in TypeScript because we like the change ourselves; but to have the .d.ts files align, is there a reason not to apart from auto-generation churn?

@ljharb ljharb force-pushed the master branch 3 times, most recently from 3d0c24c to 7a79833 Compare June 29, 2021 02:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment