Open bendtherules opened 4 years ago
@laurieontech Can you please review this when free?
What was the feedback on this one? Should i reduce the length, or this is good to go?
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:
Array.from(someArray)
as an example of cloning someArray
, in addition to spread and .values()
.slice
gets multiple values out of an array. Perhaps you meant "to clone all the values from" or "to get a fresh copy of all the values from" or "to get a copy of"?next()
returns a response Best,
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.
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)