2021-06-08 [21:05:19.0000] New idea. (Maybe, this seems simple). yield optional expression. yield?* a; where a can be undefined, null, or an iterable. if (a) { yield* a; } [21:10:05.0000] Sirisian: what's the use case? [21:10:15.0000] Sirisian: "non-nullish" doesn't mean it's iterable [21:11:54.0000] I have code that stores a set on a dom node. If it exists then it needs to emit its items else skip the element. [21:12:31.0000] seems like "if it's a set" is a better check then? [21:13:26.0000] for (const $item of items) yield?* $item.stuff; [21:14:54.0000] right but `for (const $item of items) { if ($item.stuff) { yield?* $item.stuff; } }` is much cleaner [21:19:44.0000] Would making yield* no-op if it's not an iterable be viable or does it cause issues? [21:23:34.0000] i suspect it'd cause issues, but either way `...` throws on a non-iterable by design, so it wouldn't make sense to make `yield *` behave differently [21:24:04.0000] "avoiding a conditional" is a pretty small benefit for what would be a potentially large change to the language [21:25:30.0000] ..?.a [21:25:59.0000] I'm joking. Makes sense though. I figured throwing also catches a lot of potential bugs. [21:32:30.0000] https://pastebin.com/GUdk0YPY The code is very WIP prototyping an idea, but I also had a map access.