I think introducing this operator encourages bad logic design like
"instanceof", isArray etc. These are unreadable disambiguation factors in
that they don't inform about which part the expression is going to the next
stage in the process. Also it leads to "type branching", which tends
towards more convoluted logical flow. These things, in my mind, would lead
to more bugs. Hence I would tend to be against introducing it, especially
in light of other proposals that I find more useful that haven't been taken
even to discussion.

On Fri, 6 Sep 2019, 07:58 Claude Pache, <claude.pa...@gmail.com> wrote:

>
>
> Le 5 sept. 2019 à 23:39, Andrea Giammarchi <andrea.giammar...@gmail.com>
> a écrit :
>
> This is basically a solution to a common problem we have these days, where
> modules published in the wild might have a `default` property, to support
> ESM logic, or not.
>
> ```js
> // current optional chaining logic
> const imported = exported?.default ?? exported;
>
> // my "mice operator" proposal
> const imported = exported<?.default;
> ```
>
>
>
> The semantics of the `?.` in `exported?.default` is not to check whether
> the `default` property exists, but whether `exported` evaluates to
> undefined or null. If the `default` property is absent, `exported.default`
> has always evaluated to `undefined`, and there is no need to optional
> chaining operator. So that I guess you actually meant:
>
> ``js
> const imported = exported.default ?? exported;
> ```
>
>
> —Claude
> _______________________________________________
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to