Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
feature: iterator variable names #127
Open
Conversation
|
Something to be considered:
|
|
This is looking like a great addition! I've left some comments. |
| @@ -146,6 +146,50 @@ locations.forEach((location) => { | |||
| ``` | |||
| **[⬆ back to top](#table-of-contents)** | |||
|
|
|||
| ### Avoid Mental Mapping of iterator states | |||
ryanmcdermott
Jan 16, 2017
Owner
Can you call this "Avoid Mental Mapping (part 2)" and call the one before it "Avoid Mental Mapping (part 1)".
Can you call this "Avoid Mental Mapping (part 2)" and call the one before it "Avoid Mental Mapping (part 1)".
| Nested high-performance loops can get confusing if you use incremental | ||
| letters for iterator variables. Mental mapping overhead can be reduced | ||
| when using the leading prefix letter (`d` for dataset) as the iterator | ||
| and the same name + l (`dl` for dataset) as the length or loop's |
ryanmcdermott
Jan 16, 2017
Owner
Can we remove the dl for dataset length. It does kind of go slightly against the don't over-optimize section.
Can we remove the dl for dataset length. It does kind of go slightly against the don't over-optimize section.
| ```javascript | ||
| const dataset = [[{ foo: [1,2,3,4] }], [{ foo: [1,2,3,4] }]]; | ||
| for (let d = 0, dl = dataset.length; d < dl; d++) { |
ryanmcdermott
Jan 16, 2017
Owner
Remove dl
Remove dl
| ```javascript | ||
| const dataset = [[{ foo: [1,2,3,4] }], [{ foo: [1,2,3,4] }]]; | ||
| for (let i = 0, l = dataset.length; i < l; i++) { |
ryanmcdermott
Jan 16, 2017
Owner
Remove l
Remove l
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.


Pull request as discussed in issue #49