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

Consider making $-prefixed getters SameValue with the equivalent non‑$ getters #17

Open
ExE-Boss opened this issue Jun 7, 2020 · 1 comment

Comments

@ExE-Boss
Copy link

ExE-Boss commented Jun 7, 2020

Currently, the following all log false in Firefox and the spec:

const $gOPD = Object.getOwnPropertyDescriptor;

$gOPD(RegExp, "$_").get === $gOPD(RegExp, "input").get;
$gOPD(RegExp, "$&").get === $gOPD(RegExp, "lastMatch").get;
$gOPD(RegExp, "$+").get === $gOPD(RegExp, "lastParen").get;
$gOPD(RegExp, "$`").get === $gOPD(RegExp, "leftContext").get;
$gOPD(RegExp, "$'").get === $gOPD(RegExp, "rightContext").get;

This differs from the following, which all log true:

const $TypedArray = Object.getPrototypeOf(Uint8Array);

Array.prototype.values === Array.prototype[Symbol.iterator];
$TypedArray.prototype.values === $TypedArray.prototype[Symbol.iterator];
Set.prototype.values === Set.prototype[Symbol.iterator];
Map.prototype.entries === Map.prototype[Symbol.iterator];
@claudepache
Copy link
Collaborator

Currently, the following all log false in Firefox and the spec:

They log also false in Chrome.

In Safari, the properties are implemented as “magic” value properties, so the argument does not apply.

This differs from the following, which all log true:

You can also add:

Date.prototype.toGMTString === Date.prototype.toUTCString

Argument for the change:

  • consistency with other duplicated properties in ECMA-262.

Argument for status quo:

  • 2/3 engines agree with current spec, 0/3 agree with the proposed change;

Note also that this proposal is at stage 3, which means that changes are supposed to be limited.

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

No branches or pull requests

2 participants