Apparently it is now possible to (among other things) properly fake an Array object, including the square bracket index syntax. Something which was always out of reach before. The mechanism feels kind of hacky, but that’s probably necessary for backwards compatibility reasons.
This means we can make a “real” Python-style
range object which generally pretends to be an array and supports all of the relevant parts of the Array API, but can be used in a loop / as an iterable just computing one term at a time (like the Observable standard library’s Generators.range, does fast membership testing (
.includes), and doesn’t take any memory.
I’m not up with what people are doing in JS land; maybe these new features are common knowledge. Has anyone seen uses (either clever or prosaic) of Proxy in production anywhere?