Get the latest tech news

JavaScript weakmaps should be iterable


wingolog: article: javascript weakmaps should be iterable

When WeakMap was added to JavaScript, back in the ES6 times, some implementors thought that it could be reasonable to implement weak maps not as a data structure in its own right, but rather as a kind of property on each object. GC would be free to notice dead maps and remove their associations in live objects. As with many things GC-related, non-iterability of weak maps then gained a kind of legendary status: the lore states that non-iterability preserves some key flexibility for JS implementations, and therefore it is good, and you just have to accept it and move on.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of javascript

javascript

Photo of JavaScript weakmaps

JavaScript weakmaps

Related news:

News photo

Show HN: An online 2D MMO game, written in Rust and JavaScript

News photo

How I won $2,750 using JavaScript, AI, and a can of WD-40

News photo

ASCII 3D Renderer for JavaScript