Destructuring by &reference

Augusto Moura augusto.borgesm at gmail.com
Wed Mar 3 15:46:51 UTC 2021


I don't know, the by reference destructuring seems a bit too much magical,
a scoped variable that sets to a property to a object just sounds like the
old `with` statement but reduced and more explicit, given is just a sugar
and currently the problem is not a great of a pain point I would be very
picky a proposal like that, any prior art in other languages?

Also, from a grammar/vendor implementation standpoint I would imagine the
definition of a by reference variable bind would be kinda fishy, I might be
wrong though

Em ter., 2 de mar. de 2021 às 21:03, Claudia Meadows <
contact at isiahmeadows.com> escreveu:

> I would like to see this happen, though I'd like to see it integrated with
> reified refs. (I know there's a proposal laying around somewhere drafted up
> by a current or former TC39 person, but I can't find it.)
>
> -----
>
> Claudia Meadows
> contact at isiahmeadows.com
>
>
> On Tue, Mar 2, 2021 at 11:05 AM Andrea Giammarchi <
> andrea.giammarchi at gmail.com> wrote:
>
>> Another one (cit. DJ Khaled)
>>
>> has "by reference" ever been considered as "yet another JS syntax" ???
>>
>> let object = {value: 1};
>> let {&value} = object;
>> value = 2;
>>
>> object.value; // 2
>>
>> allowed everywhere destructuring is possible, throwing for frozen
>> properties ... is this just meh? .. .'cause I think, specially for function
>> signatures declaration, it might make a difference, when mutability matters.
>>
>> Cheers 👋
>>
>> P.S. for transpilers this would simply carry, repeatedly, the initial
>> reference.prop around, instead of using just prop.
>>
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>


-- 
Atenciosamente,

Augusto Borges de Moura
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20210303/9b944b02/attachment.html>


More information about the es-discuss mailing list