ecma262 icon indicating copy to clipboard operation
ecma262 copied to clipboard

Editorial: Rework Module Namespace's [[Get]] method

Open shvaikalesh opened this issue 4 years ago • 1 comments

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.

shvaikalesh avatar Mar 01 '21 15:03 shvaikalesh

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.

syg avatar Mar 17 '21 22:03 syg