tc39 / js-outreach-groups

63 stars 7 forks source link

[Review] How does in-built Array iterator work? #37

Open bendtherules opened 4 years ago

bendtherules commented 4 years ago

I wrote a blog post on how in-built Array iterator works - https://blog.bendtherul.es/how-does-in-built-array-iterator-work-ckciw2lr900d0xas144h5fpwm

Would like to get some feedback.

(Word count - 626 including the refresher section on iterator protocol. Without that, 527)

bendtherules commented 4 years ago

@laurieontech Can you please review this when free?

bendtherules commented 4 years ago

What was the feedback on this one? Should i reduce the length, or this is good to go?

tdd commented 4 years ago

Hey @bendtherules,

Cool article! I'm not sure whether this group is looking for dive-into-implementation articles so much as API-surface articles, but I'm a sucker for knowing the internals of things, so I like it 👍

Just a few things off the top of my head:

Best,

bendtherules commented 4 years ago

Thanks for your detailed feedback @tdd.

About your observations - 1 - Yes, i checked and looks like built-in is the nore common form. I can edit that. 2 and 3 - I used the rest operator and .values example because both of them use the iterator internally, while others like slice (probably) don't. I guess it would be better to say copy/clone all variables, like you suggested.

4 - I will fix that.

5 - True, implications is the more juicy part. My hope is that after seeing some edge cases there, readers will look back at the full algo to understand them.

(Also yes, most of the articles here are around new proposals, but IMO, it's also interesting to look back at the "old" stuff to really understand how it works.)

Thanks again for taking a detailed look.