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: Rework Module Namespace's [[Get]] method #2336

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

shvaikalesh
Copy link
Member

This PR merely inlines Module Namespace's [[Get]] into its [[GetOwnProperty]] method because:

  • [[Get]] doesn't (need to) terminate prototype chain traversal, unlike TypedArray's [[Get]], since module namespace object's prototype is null and it's non-extensible.
  • Some Module Namespace's methods like [[HasProperty]] or [[Delete]] are subtly different from ordinary ones: they prevent from calling into [[GetOwnProperty]] that may throw. We should avoid having methods that are totally equivalent to ordinary ones, like [[Get]], so they won't be accidentally ignored by implementors.
  • It relieves runtimes from calling into [[Get]] override, and continue performing OrdinaryGet, which is preferred for simplicity / performance reasons.

@ljharb ljharb added editor call to be discussed in the next editor call editorial change labels Mar 3, 2021
@syg
Copy link
Contributor

syg commented Mar 17, 2021

We discussed this on the editor call, and the conclusion is:

  • We like the change to get [[Get]] delegating to [[GetOwnProperty]], since that's the usual state of things.
  • We'd like to keep an explicit [[Get]] instead of removing it for clarity. We recommend copy/pasting the relevant parts of ordinary objects' [[Get]], with the irrelevant parts omitted. A note that says this is just ordinary [[Get]] with irrelevant parts omitted would be helpful.
  • Keep the steps inlined into [[GetOwnProperty]] as you currently have.

@bakkot bakkot removed the editor call to be discussed in the next editor call label Mar 17, 2021
@shvaikalesh shvaikalesh force-pushed the module-namespace-remove-get-method branch from 79fbc2b to 61a75f2 Compare April 3, 2021 22:13
@shvaikalesh shvaikalesh changed the title Editorial: Remove Module Namespace's [[Get]] method Editorial: Rework Module Namespace's [[Get]] method Apr 3, 2021
@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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants