tc39 / proposal-get-intrinsic

EcmaScript language proposal for a way to get intrinsics.
https://tc39.github.io/proposal-get-intrinsic/
MIT License
32 stars 4 forks source link

Iteration: an internal Map + MapIterator vs an internal List + something else? #20

Closed ljharb closed 1 year ago

ljharb commented 1 year ago

In #17, I changed the spec to use a Map internally, and then to reuse a Map iterator.

A suggested alternative was to use a List internally, and just iterate over the list. However, that would require either creating a new intrinsic IntrinsicIterator, or, to just use a standard generator, neither of which feels ideal.

Thoughts?

ljharb commented 1 year ago

I'm going to recommend here to use a Map iterator, rather than creating a new intrinsic. The Map instance itself never needs to be reified.

If implementations have an issue with this, then my fallback would be to make an IntrinsicIterator intrinsic.

Closing, since the spec currently uses the Map iterator and I've heard no strong opinions on this.