tc39 / proposal-flatMap

proposal for flatten and flatMap on arrays
https://tc39.github.io/proposal-flatMap
214 stars 19 forks source link

Should these names be added to @@unscopables? #74

Closed ajklein closed 5 years ago

ajklein commented 5 years ago

Array methods added in ES2015 and ES2016 were added to the @@unscopables object attached to Array.prototype, to avoid a set of web-compat worries. Should flat and flatMap be added as well? Or was that considered and rejected for some reason?

Note that I'm not aware of any breakage due to them being left off, I just noticed this inconsistency while cleaning up some code.

@mathiasbynens

mathiasbynens commented 5 years ago

Great catch! @michaelficarra, WDYT?

michaelficarra commented 5 years ago

I'm fine either way. We could just add them for consistency, or we could also keep them out until/unless we find they are needed.

mathiasbynens commented 5 years ago

I'm leaning towards adding them for consistency and "just in case".

V8 patch: https://chromium-review.googlesource.com/c/v8/v8/+/1390125

mathiasbynens commented 5 years ago

Looking at this more closely, the text below the Array.prototype[@@unscopables] section in the spec makes it clear that the intention is to prevent issues, rather than fix only the cases that are known to break the web. Note the use of the word "might".

PR: https://github.com/tc39/proposal-flatMap/pull/75

tschneidereit commented 5 years ago

SpiderMonkey implementation bug.