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: Tweak EnumerateObjectProperties informative definition #656

Merged
merged 5 commits into from
Aug 12, 2016
Merged

Editorial: Tweak EnumerateObjectProperties informative definition #656

merged 5 commits into from
Aug 12, 2016

Conversation

shvaikalesh
Copy link
Member

@shvaikalesh shvaikalesh commented Aug 12, 2016

  1. Add missing semicolon.
  2. Improve variable naming consistency (protoName --> protoKey, because key).
  3. Early continue for symbols (less indentation, more obvious what keys are skipped).
  4. Use const instead of let.

@@ -16175,16 +16175,16 @@
for (let key of Reflect.ownKeys(obj)) {
if (typeof key === "string") {
let desc = Reflect.getOwnPropertyDescriptor(obj, key);
if (desc && !visited.has(key)) {
if (desc && !visited.has(key)) {
Copy link
Contributor

@claudepache claudepache Aug 12, 2016

Choose a reason for hiding this comment

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

Why? it just makes the code in spec.html less readable.

Copy link
Member

Choose a reason for hiding this comment

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

Agreed. @shvaikalesh See https://mathiasbynens.be/notes/ambiguous-ampersands for more info on why this is perfectly valid.

Copy link
Member Author

Choose a reason for hiding this comment

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

@mathiasbynens, thanks for the article. I dropped this commit and will make another PR to unescape all unambiguous ampersands in spec.html.

if (desc.enumerable) yield key;
}
const visited = new Set;
for (const key of Reflect.ownKeys(obj)) {
Copy link
Member

Choose a reason for hiding this comment

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

there's no tweak here. This change is not necessary at all and for consistency it is better to remain without change.

Copy link
Member Author

Choose a reason for hiding this comment

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

@leobalter, thanks for the review. Is it 46b569d or f1883f5 that should be dropped?

Copy link
Member

Choose a reason for hiding this comment

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

I'm just part of TC39, @bterlson is the one able to answer that.

Copy link
Member

Choose a reason for hiding this comment

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

I think it's ok to change it to use const, since it's never reassigned. I'd also want to see new Set() while we're at it :-)

Copy link
Member

Choose a reason for hiding this comment

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

I am fine with this change. I don't see why this change isn't consistent though - @leobalter can you clarify?

Copy link
Member

Choose a reason for hiding this comment

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

I prefer this example being consistent (the same) along the new releases.

  • replacing let w/ const will make it valid to replace const w/ let in any near future as we don't enforce any particular use.

Copy link
Member

Choose a reason for hiding this comment

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

We do enforce a particular use in the spec at least - whatever I feel like 😈

My feelings may change (I have in fact become far less likely to use const) but for now I think this helps and I promise I won't change it back to let any time soon.

Copy link
Member Author

@shvaikalesh shvaikalesh Aug 12, 2016

Choose a reason for hiding this comment

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

@ljharb addressed in aff0edd, thanks for the feedback.

@shvaikalesh shvaikalesh changed the title Editorial: Tweak EnumerateObjectProperties informal definition Editorial: Tweak EnumerateObjectProperties informative definition Aug 12, 2016
@bterlson bterlson merged commit 5ee666e into tc39:master Aug 12, 2016
jaychsu added a commit to jaychsu/ecma262 that referenced this pull request Sep 7, 2016
* upstream/master: (301 commits)
  Editorial: remove mistakenly committed change to eval-related super errors
  Normative: Point to the latest version of UTR15 (tc39#681)
  Meta: update ecmarkup version dependency (tc39#682)
  Editorial: Update a variable name in Annex B.3.3.1 to refer to the proper variable in FunctionDeclarationInstantiation's body, and add warning comments by all the spec algorithms monkey-patched by Annex B so that future refactoring doesn't create broken/dangling references in Annex B. (tc39#677)
  Meta: update ecmarkup version dependency
  Editorial: dfn-ify 'goal symbol'
  Editorial: TypeArray -> TypedArray (tc39#675)
  Editorial: Correct a wrong cross-reference in Annex C (tc39#674)
  Editorial: tweak whitespace and articles (tc39#667)
  Editorial: Tweak EnumerateObjectProperties informative definition (tc39#656)
  Editorial: Rename variable (indx --> index) (tc39#658)
  Editorial: Fix reference in ScriptEvaluation (tc39#659)
  Editorial: Consistent `undefined or null` order (tc39#660)
  Editorial: Refactor Array.prototype.toLocaleString (tc39#662)
  Editorial: Tweak Array.prototype.join (tc39#661)
  Simplify description of CreateImmutableBinding (tc39#654)
  Normative: Resolve template argument references (tc39#609)
  Editorial: Refactor Array.prototype.join (tc39#638)
  Editorial: contains --> Contains in ModuleListItem SS
  Normative: Allow initializers in ForInStatement heads (tc39#614)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants