13:39 | <Justin Ridgewell> | How would I construct a Map from a Spec List without any observable behaviors? |
13:40 | <ljharb> | https://tc39.es/ecma262/#sec-add-entries-from-iterable |
13:41 | <ljharb> | hm, actually that's a lot of hoops |
13:41 | <Justin Ridgewell> | I would have to convert my List<List<*>> into Array<[key, value]> , first |
13:41 | <ljharb> | see steps 3-7 in https://tc39.es/ecma262/#sec-map.prototype.set |
13:41 | <Justin Ridgewell> | Can I just construct a object with [[MapData]] ? |
13:42 | <ljharb> | iow, iterate over the list, and just mutate the Map entries of the Map you created |
13:43 | <Justin Ridgewell> | 👍️ |
13:44 | <bakkot> |
You can but for clarity I would call |
13:44 | <bakkot> | I like having Map be the sole thing which creates an object with a [[MapData]] |
13:44 | <Justin Ridgewell> | Thanks |
13:47 | <annevk> | That's pretty much what structured deserializing does for Map objects, although we don't construct the objects properly; I guess shu gets to fix that 😛 |
13:47 | <ljharb> | maybe an AO is in order that HTML and grouping can use |
13:49 | <bakkot> | CreateMapFromList, why not |
13:59 | <Justin Ridgewell> | That's pretty much what structured deserializing does for Map objects, although we don't construct the objects properly; I guess shu gets to fix that 😛 |
13:59 | <Justin Ridgewell> | Curious what data structure you have, so I can put together a helper abstract op |
14:02 | <annevk> | Justin Ridgewell: https://html.spec.whatwg.org/#structureddeserialize then search for [[MapData]] |
14:02 | <annevk> | Justin Ridgewell: there's a plan of sorts to move a lot of that into ECMAScript aiui, shu would know more |
14:03 | <shu> | Justin Ridgewell: see domenic's comment at the bottom of https://github.com/tc39/ecma262/issues/2555 |
14:03 | <shu> | mostly some mechanical shoring up of the language in HTML around object creation. i haven't looked too deep but can't imagine its being very problematic |
14:06 | <Justin Ridgewell> | Looks like you already have a { [[Key]]: key, [[Value]]: Value } record, and you're just ferrying things through the realms |
14:07 | <Justin Ridgewell> | I can modify my ops to match that pretty easily, then call a CreateMapFromList with List<{ [[Key]], [[Value]] }> |