Re: Allowing object field name shorthand

2017-06-27 Thread T.J. Crowder
fier of the expression. This differs from the proposal at the start > of this thread, but may also be worth considering. > > > > Ron > > > > (My apologies for formatting as I wrote this up on my phone) > > > > *From: *Mark <m...@heyimmark.com> > *Se

RE: Allowing object field name shorthand

2017-06-25 Thread Ron Buckton
ies for formatting as I wrote this up on my phone) From: Mark<mailto:m...@heyimmark.com> Sent: Sunday, June 25, 2017 10:09 AM To: Michael Kriegel<mailto:michael.krie...@actifsource.com>; es-discuss@mozilla.org<mailto:es-discuss@mozilla.org> Subject: Re: Allowing object field name s

Re: Allowing object field name shorthand

2017-06-25 Thread Mark
Another -1 for this. It adds complexity to object initializer processing, both in the obvious way (has to figure out to create the hidden object or possibly several nested hidden objects), and around the fact that object initializers are processed in source code order. Exactly, this proposal

Re: Allowing object field name shorthand

2017-06-22 Thread Michael Kriegel
I also vote against this. A further problem could be duplication of field names in large objects. Imagine there is a field2.field3.field4.field5 in the beginning of your object and then another one 100 lines below. Using the currently well defined way to define nested objects at least groups

Re: Allowing object field name shorthand

2017-06-22 Thread Sebastian Malton
I don't see how this is like referencing the object a field is in during object construction. Yes field2.field4 would not be able to reference field2.field3 but that is not what I am proposing. I am proposing a syntactic sugar for nested objects On 2017-06-22 10:05 PM, J Decker wrote: On

Re: Allowing object field name shorthand

2017-06-22 Thread J Decker
On Thu, Jun 22, 2017 at 7:56 AM, Sebastian Malton wrote: > I would like to propose that the dot or '.' is allowed in object field > names so that the following are allowed. > > var obj = { > field1: "val" , > field2.field3: 3, > field2.field4: true > }; > >

Re: Allowing object field name shorthand

2017-06-22 Thread kai zhu
point to a sub object >> >> Sebastian >> >> *From:* tj.crow...@farsightsoftware.com >> *Sent:* June 22, 2017 1:14 PM >> *To:* sebast...@malton.name >> *Cc:* es-discuss@mozilla.org >> *Subject:* Re: Allowing object field name shorthand >> >>

Re: Allowing object field name shorthand

2017-06-22 Thread T.J. Crowder
has as least two different ways. > ``` > > Currently not using quotes is valid method of defining field names but if > you use quotes you can get names that look like they point to a sub object > > Sebastian > > *From:* tj.crow...@farsightsoftware.com > *Sent:* June 22, 2017

Re: Allowing object field name shorthand

2017-06-22 Thread Sebastian Malton
: June 22, 2017 1:14 PMTo: sebast...@malton.nameCc: es-discuss@mozilla.orgSubject: Re: Allowing object field name shorthand On Thu, Jun 22, 2017 at 5:53 PM, Sebastian Malton <sebast...@malton.name> wrote: I would say that the easiest benefit would be the shorthand.But as I pointed out, it

Re: Allowing object field name shorthand

2017-06-22 Thread T.J. Crowder
On Thu, Jun 22, 2017 at 5:53 PM, Sebastian Malton wrote: > I would say that the easiest benefit would be the shorthand. > But as I pointed out, it's not shorthand unless the object only has one property. As of the second property, it's only more concise if the main

Re: Allowing object field name shorthand

2017-06-22 Thread Bob Myers
On Thu, Jun 22, 2017 at 10:23 PM, Sebastian Malton wrote: > In my opinion the notation of {"n.b": 1} should equate to {n.b: 1} so that > object field retrieval is consistent. That's a hugely breaking change. ___ es-discuss

Re: Allowing object field name shorthand

2017-06-22 Thread Sebastian Malton
w...@farsightsoftware.comSent: June 22, 2017 11:52 AMTo: sebast...@malton.nameCc: es-discuss@mozilla.orgSubject: Re: Allowing object field name shorthand Can you expand on the benefits vs. costs (e.g., complexity, clarity)?I ask because I'm not immediately seeing a lot of benefit, but I'm seeing vario

Re: Allowing object field name shorthand

2017-06-22 Thread T.J. Crowder
Can you expand on the benefits vs. costs (e.g., complexity, clarity)? I ask because I'm not immediately seeing a lot of benefit, but I'm seeing various costs: 1. It adds more hidden behavior (creating the object). 2. It makes object initializers more confusing to human readers. The syntaxes

Allowing object field name shorthand

2017-06-22 Thread Sebastian Malton
I would like to propose that the dot or '.' is allowed in object field names so that the following are allowed. var obj = {    field1: "val" ,    field2.field3: 3,    field2.field4: true};would become var obj = {    field1: "val" ,    field2: {        field3: 3,        field4: true    }};and