Suggestion: Destructuring object initializer.

Naveen Chawla naveen.chwl at gmail.com
Mon Feb 12 07:46:09 UTC 2018


A big thing in a programming language for me is "glanceability" (ability to
glance at code and discern roughly what's going on).

Allowing destructuring braces to be mixed in object literals may well be a
natural extension of destructuring: I'm not denying that.

I just think that since they unfortunately share the same symbols for
different-meaning things, I think that a reader of the code may
accidentally misunderstand the structure of the object literal and presume
to access its properties wrongly, leading to a bug and wasted time. This
for me is a counter-rationale for the (or any new) feature in the language.

However, if it was more visually discernable, then it wouldn't have this
issue.

On Mon, 12 Feb 2018 at 05:24 Jerry Schulteis <jdschulteis at yahoo.com> wrote:

> I had the same concern at first about confusing the destructuring braces
> with a nested object literal. After looking at it some more it seems like a
> natural extension of destructuring assignment.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180212/b885fd5c/attachment.html>


More information about the es-discuss mailing list