Re: Re: Proposing a conditional assignment (or equals) operator

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Re: Proposing a conditional assignment (or equals) operator

Ari Porad

Hi All,

Given that optional chaining is now stage–1, would there be interest in reviving this proposal? (This idea originated from my comment here.)

Apologies if this isn’t the proper way to suggest this idea, it’s my first time posting on es-discuss!


_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Re: Proposing a conditional assignment (or equals) operator

Isiah Meadows-2

I'd like to see it myself, actually. Currently, the closest we have is this (which only works for `undefined`s):

```js
[foo = "default"] = [bar]
```


On Mon, Aug 14, 2017, 21:11 Ari Porad <[hidden email]> wrote:

Hi All,

Given that optional chaining is now stage–1, would there be interest in reviving this proposal? (This idea originated from my comment here.)

Apologies if this isn’t the proper way to suggest this idea, it’s my first time posting on es-discuss!

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Proposing a conditional assignment (or equals) operator

Claude Pache
In reply to this post by Ari Porad
This feature is more related to null coalescing (evaluate the RHS when the LHS is null) than to optional chaining (evaluate the LHS when the LHS is *not* null).


—Claude

Le 15 août 2017 à 03:11, Ari Porad <[hidden email]> a écrit :

Hi All,

Given that optional chaining is now stage–1, would there be interest in reviving this proposal? (This idea originated from my comment here.)

Apologies if this isn’t the proper way to suggest this idea, it’s my first time posting on es-discuss!

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss


_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Proposing a conditional assignment (or equals) operator

kai zhu
this proposal is not as useful as you would think.  when integrating
with api's and modules not written by yourself, you will always be
self-doubting whether the "other" guy who wrote their code used
null/undefined/false/0/<empty string> values, causing you to avoid
using this feature in general.

the <empty string> is commonly treated as a defacto null when reading
dom-element attributes or when fetching web-data


On 8/15/17, Claude Pache <[hidden email]> wrote:

> This feature is more related to null coalescing (evaluate the RHS when the
> LHS is null) than to optional chaining (evaluate the LHS when the LHS is
> *not* null).
>
> See https://github.com/gisenberg/proposal-nullary-coalescing/issues/1
> <https://github.com/gisenberg/proposal-nullary-coalescing/issues/1>
>
> —Claude
>
>> Le 15 août 2017 à 03:11, Ari Porad <[hidden email]> a écrit :
>>
>> Hi All,
>>
>> Given that optional chaining is now stage–1, would there be interest in
>> reviving this proposal? (This idea originated from my comment here
>> <https://github.com/tc39/proposal-optional-chaining/issues/18#issuecomment-322329156>.)
>>
>> Apologies if this isn’t the proper way to suggest this idea, it’s my first
>> time posting on es-discuss!
>>
>> _______________________________________________
>> es-discuss mailing list
>> [hidden email] <mailto:[hidden email]>
>> https://mail.mozilla.org/listinfo/es-discuss
>> <https://mail.mozilla.org/listinfo/es-discuss>
>
>
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Proposing a conditional assignment (or equals) operator

Alexander Jones
For what it's worth, doubling down on a design that exposes such poor choices wouldn't necessarily be a bad thing ;)

On Wed, 16 Aug 2017 at 02:56, kai zhu <[hidden email]> wrote:
this proposal is not as useful as you would think.  when integrating
with api's and modules not written by yourself, you will always be
self-doubting whether the "other" guy who wrote their code used
null/undefined/false/0/<empty string> values, causing you to avoid
using this feature in general.

the <empty string> is commonly treated as a defacto null when reading
dom-element attributes or when fetching web-data


On 8/15/17, Claude Pache <[hidden email]> wrote:
> This feature is more related to null coalescing (evaluate the RHS when the
> LHS is null) than to optional chaining (evaluate the LHS when the LHS is
> *not* null).
>
> See https://github.com/gisenberg/proposal-nullary-coalescing/issues/1
> <https://github.com/gisenberg/proposal-nullary-coalescing/issues/1>
>
> —Claude
>
>> Le 15 août 2017 à 03:11, Ari Porad <[hidden email]> a écrit :
>>
>> Hi All,
>>
>> Given that optional chaining is now stage–1, would there be interest in
>> reviving this proposal? (This idea originated from my comment here
>> <https://github.com/tc39/proposal-optional-chaining/issues/18#issuecomment-322329156>.)
>>
>> Apologies if this isn’t the proper way to suggest this idea, it’s my first
>> time posting on es-discuss!
>>
>> _______________________________________________
>> es-discuss mailing list
>> [hidden email] <mailto:[hidden email]>
>> https://mail.mozilla.org/listinfo/es-discuss
>> <https://mail.mozilla.org/listinfo/es-discuss>
>
>
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss