Since object spread already ignores nullish values, a syntax change would only be needed for array spread. Then, the two kinds of spread would support different syntactic features, which seems inconsistent.
On Sat, Feb 15, 2020 at 7:56 AM Beknar Askarov <[email protected]> wrote: > Thank you, everyone, for feedback. Sorry for not getting back for a while. > I had some time to think and concluded that nullish noop in spreading is a > good feature to be added to the language without complicating it too much. > So please take a look at the explainer > <https://gist.github.com/askbeka/8bb17508ec250a789ea9bff683a50e38> and > lets discuss in es-discourse proposal > <https://es.discourse.group/t/optional-spreading-proposal/224>, if you > have further feedback, please share > > On Fri, Aug 23, 2019 at 7:18 PM Herby Vojčík <[email protected]> wrote: > >> On 23. 8. 2019 16:24, Beknar Askarov wrote: >> > @Scott Rudiger After thinking more about it. >> > I would not like to conflict with semantics of optional chaining and >> > null coalescing operator. >> > So in order to not confuse people, maybe introduce two types of >> optional >> > spread operators >> > >> > >> > 1. `?...` - Do not spread if nullish. Note nullish. Else try to spread. >> > Signature Array: [?...(nullish | Iterable)]; >> > Signature Object: {?...(nullish | object)}; >> > >> > 2. `!...` - Do not spread if false. Note FALSE not falsy. Else try to >> > spread. >> >> I read >> >> !...foo >> >> as >> >> !(...foo) >> >> that is, logical not. I'd tip it already works that way. In which case >> no go, break compat. >> >> Herby >> >> > Signature Array: [!...(false | Iterable)]; >> > Signature Object: {!...(false | object)}; >> > >> > I think this can be an option to avoid consfusion >> >> Or add a new one. :-( >> >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

