[Proposal] Optional spreading

Herby Vojčík herby at mailbox.sk
Fri Aug 23 17:18:46 UTC 2019


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. :-(


More information about the es-discuss mailing list