Improvements in Property Access for Object Initializers

Improvements in Property Access for Object Initializers
Slide Note
Embed
Share

The proposal by Ron Buckton of Microsoft Corporation introduces shorthand improvements in property access within object initializers and destructuring assignments. It explores enhancements to object initializers, destructuring assignments, and the semantics behind them. The proposal aims to simplify coding practices and enhance readability by providing more concise ways to access object properties.

  • JavaScript
  • Shorthand Property
  • Object Initializers
  • Destructuring Assignments

Uploaded on Feb 15, 2025 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. SHORTHAND PROPERTY IMPROVEMENTS Ron Buckton Microsoft Corporation

  2. Property Access in object initializers // object initializer, dot-notation const a = { o.x }; Property Access in destructuring assignments // object initializer, bracket-notation const a = { o["x"] }; // destructuring, dot-notation ({ a.x } = o); // destructuring, bracket-notation ({ a["x"] } = o); PROPOSAL

  3. Object initializers {o.x} is identical to {x: o.x} {o["x"]} is (roughly) identical to {["x"]: o["x"]} Destructuring Assignment ({a.x} = o) is identical to ({x: a.x} = o} ({a["x"] } = o) is (roughly) identical to ({["x"]: a["x"]} = o) Actual implementations would use GetReferencedName SEMANTICS

  4. PropertyDefinition[Yield, Await] : MemberExpression[?Yield, ?Await] .IdentifierName MemberExpression[?Yield, ?Await] [Expression] CallExpression[?Yield, ?Await] .IdentifierName CallExpression[?Yield, ?Await] [Expression] AssignmentProperty[Yield, Await] : MemberExpression[?Yield, ?Await] .IdentifierNameInitializer[+In, ?Yield, ?Await]opt MemberExpression[?Yield, ?Await] [Expression]Initializer[+In, ?Yield, ?Await]opt CallExpression[?Yield, ?Await] .IdentifierNameInitializer[+In, ?Yield, ?Await]opt CallExpression[?Yield, ?Await] [Expression]Initializer[+In, ?Yield, ?Await]opt GRAMMAR

  5. Stage: 0 Identified Champions: Ron Buckton Strawman available https://github.com/rbuckton/proposal-shorthand-improvements STATUS

More Related Content