Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Spec review #35

Merged
merged 4 commits into from
Sep 8, 2019
Merged

Spec review #35

merged 4 commits into from
Sep 8, 2019

Conversation

ljharb
Copy link
Member

@ljharb ljharb commented Sep 4, 2019

Partial fixes for #33.

@ljharb ljharb mentioned this pull request Sep 4, 2019
5 tasks
1. Perform ! DefinePropertyOrThrow ( _O_, `"errors"`, _errorsDesc_ ).
1. Let O be ? OrdinaryCreateFromConstructor(_newTarget_, `"%AggregateError.prototype%"`, « [[ErrorData]] »).
1. Let _errorsArray_ be ! CreateArrayFromList(? IterableToList(_errors_)).
1. Perform ! CreateMethodProperty(_O_, `"errors"`, _errorsArray_).
Copy link
Contributor

@zloirock zloirock Sep 4, 2019

Choose a reason for hiding this comment

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

Sure, CreateMethodProperty makes sense here, but, since it's not a method and since this operation is not actively used in the spec, maybe it should be renamed to something like CreateNonEnumerableProperty?

Copy link
Member Author

Choose a reason for hiding this comment

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

Perhaps so, but that’s an editorial change I’d make separately.

Copy link
Member

@chicoxyzzy chicoxyzzy left a comment

Choose a reason for hiding this comment

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

Thank you!

</tr>
</tbody>
</table>
</emu-table>
Copy link
Member

Choose a reason for hiding this comment

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

AFAIU this table should also include AggregateError.prototype

Copy link
Member Author

@ljharb ljharb Sep 5, 2019

Choose a reason for hiding this comment

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

I intentionally did not include it; prototype objects no longer need to be indicated explicitly since we have the intrinsic dot syntax. The current ones are all legacy.

1. Let _errorsDesc_ be the PropertyDescriptor { [[Value]]: _errorsArray_, [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.
1. Perform ! DefinePropertyOrThrow ( _O_, `"errors"`, _errorsDesc_ ).
1. Let O be ? OrdinaryCreateFromConstructor(_newTarget_, `"%AggregateError.prototype%"`, « [[ErrorData]] »).
1. Let _errorsArray_ be ! CreateArrayFromList(? IterableToList(_errors_)).
Copy link
Collaborator

@bakkot bakkot Sep 6, 2019

Choose a reason for hiding this comment

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

I am not a fan of using multiple !/? macros in a single algorithm step. It's probably clear to a human, but it is not allowed by the current definition of the macros and it is not totally clear to me if it would be allowed after tc39/ecma262#1573.

(And there's no real reason not to just introduce a new variable and make it totally unambiguous.)

Copy link
Member Author

Choose a reason for hiding this comment

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

We definitely do it in the spec in a number of places already; if 1573 wouldn’t allow it, we should ensure it will.

I could split it up, but I don’t think it adds clarity to do so.

Copy link
Member

Choose a reason for hiding this comment

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

I tend to agree with:

(And there's no real reason not to just introduce a new variable and make it totally unambiguous.)

Happy to make this change separately though. No need to block this pull request.

@mathiasbynens
Copy link
Member

This still LGTM.

@chicoxyzzy chicoxyzzy merged commit 24ae63a into tc39:master Sep 8, 2019
@ljharb ljharb deleted the spec_review branch September 8, 2019 18:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants