Skip to content

Conversation

michaelficarra
Copy link

@michaelficarra michaelficarra commented Sep 16, 2025

  1. it's not a brand check like isError or isArray, it's just a check
  2. link to isError in 262, it's no longer a proposal
  3. add reference to Array.isArray as well
  4. mention the associated magic behaviour for each of the precedent-setting methods

1. it's not a brand check like isError or isArray, it's just a check
1. link to isError in 262, it's no longer a proposal
1. add reference to `Array.isArray` as well
1. mention the associated magic behaviour for each of the precedent-setting methods
@ljharb
Copy link

ljharb commented Sep 17, 2025

Of course it's a brand check, it looks for an internal slot.

@michaelficarra
Copy link
Author

Brands are indelible and innate. All Dates are created with a [[DateValue]] slot which cannot be removed. Thus it's a brand. The [[Prototype]] slot having a particular value is not a brand because its value can change over time, "removing" the "brand".

@bakkot
Copy link

bakkot commented Sep 17, 2025

This proposal (at least as currently specified) does not look at the [[Prototype]] slot. There's different operations which do that subsequent to checking IsPromise, but this proposal would just be the IsPromise part, and you can then check the [[Prototype]] slot yourself if you want to match those operations.

@michaelficarra
Copy link
Author

Ah I see, this is just checking [[PromiseState]]. That does appear to be a brand.

@mhofman
Copy link
Owner

mhofman commented Sep 17, 2025

Yup this is specifically about exposing the brand check that is used as part of different checks through the spec. The goal is to be able to know what behavior a value will have when used by these spec operations (e.g. await), so that userland can decide to handle other values differently.

@mhofman
Copy link
Owner

mhofman commented Sep 17, 2025

I was originally reticent to mention the Array.isArray case since the IsArray AO has special behaviors for proxies which wouldn't exists for promises, but I think that difference is not meaningful for most.

@michaelficarra
Copy link
Author

I think it's actually a good thing to mention isArray for that reason so that we can explicitly call out to committee that we do not want to pierce proxies like isArray.

@mhofman mhofman force-pushed the main branch 2 times, most recently from 7a8520d to 9ae3d18 Compare September 22, 2025 11:42
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.

4 participants