Stage _ Draft / July 26, 2017

Comma-separated fields

Introduction

This proposal introduces comma-separated field declarations. See the explainer for motivation and status.

1Syntax

FieldDefinitionList[Yield, Await]:FieldDefinition[?Yield, ?Await] FieldDefinitionList[?Yield, ?Await],FieldDefinition[?Yield, ?Await] ClassElement[Yield, Await]:MethodDefinition[?Yield, ?Await] staticMethodDefinition[?Yield, ?Await] FieldDefinitionList[?Yield, ?Await]; staticFieldDefinitionList[?Yield, ?Await]; FieldDefinition[?Yield, ?Await]; staticFieldDefinition[?Yield, ?Await]; ;

2Semantics

2.1Static Semantics: Early Errors

ClassElement:static FieldDefinitionFieldDefinitionList;
  • It is a Syntax Error if PropName of FieldDefinition isPropNames of FieldDefinitionList contains "prototype" or "constructor". .
ClassElement:FieldDefinitionFieldDefinitionList;
  • It is a Syntax Error if PropName of FieldDefinition isPropNames of FieldDefinitionList contains "constructor". .

2.1.1Static Semantics: PropNames

FieldDefinitionList[Yield, Await]:FieldDefinitionList[?Yield, ?Await],FieldDefinition[?Yield, ?Await]
  1. Let propNames be PropNames of FieldDefinitionList.
  2. Let propName be PropName of FieldDefinition.
  3. Append propName to propNames.
  4. Return propNames.
FieldDefinitionList[Yield, Await]:FieldDefinition[?Yield, ?Await]
  1. Return a List containing PropName of FieldDefinition.

2.1.2Static Semantics: ClassElementEvaluation

With parameters object and enumerable.

- ClassElement:static FieldDefinitionFieldDefinitionList;
  1. Return ClassFieldDefinitionEvaluation of FieldDefinitionFieldDefinitionList with parameter true and object.
ClassElement:FieldDefinitionFieldDefinitionList;
  1. Return ClassFieldDefinitionEvaluation of FieldDefinitionFieldDefinitionList with parameter false and object.

2.1.3Runtime Semantics: ClassFieldDefinitionEvaluation

With parameters isStatic and homeObject.

FieldDefinitionList[Yield, Await]:FieldDefinitionList[?Yield, ?Await],FieldDefinition[?Yield, ?Await]
  1. Let fields be ? ClassFieldDefinitionEvaluation of FieldDefinitionList.
  2. Let field be ? ClassFieldDefinitionEvaluation of FieldDefinition.
  3. Append field to fields.
  4. Return fields.
FieldDefinitionList[Yield, Await]:FieldDefinition[?Yield, ?Await]
  1. Return a List containing ? ClassFieldDefinitionEvaluation of FieldDefinition.

2.1.4Static Semantics: PrivateBoundNames

FieldDefinitionList:FieldDefinition
  1. Return PrivateBoundNames of FieldDefinition
FieldDefinitionList:FieldDefinitionList,FieldDefinition
  1. Let names be PrivateBoundNames of FieldDefinitionList.
  2. Let additionalNames be PrivateBoundNames of FieldDefinition.
  3. Append the elements of additionalNames to names.
  4. Return names.

2.1.5Static Semantics: IsStatic

ClassElement:FieldDefinitionFieldDefinitionList
  1. Return false.
ClassElement:static FieldDefinitionFieldDefinitionList
  1. Return true.

2.2Static Semantics: NonConstructorElementDefinitions

ClassElementList:ClassElement
  1. If ClassElement is ClassElement:; , return a new empty List.
  2. If ClassElement is ClassElement:FieldDefinitionFieldDefinitionList; , return a new empty List.
  3. If ClassElement is ClassElement:static FieldDefinitionFieldDefinitionList; , return a new empty List.
  4. If IsStatic of ClassElement is false and PropName of ClassElement is "constructor", return a new empty List.
  5. Return a List containing ClassElement.
ClassElementList:ClassElementListClassElement
  1. Let list be NonConstructorElementDefinitions of ClassElementList.
  2. If ClassElement is ClassElement:; , return list.
  3. If ClassElement is ClassElement:FieldDefinitionFieldDefinitionList; , return a new empty List.
  4. If ClassElement is ClassElement:static FieldDefinitionFieldDefinitionList; , return a new empty List.
  5. If IsStatic of ClassElement is false and PropName of ClassElement is "constructor", return list.
  6. Append ClassElement to the end of list.
  7. Return list.

ACopyright & Software License

Copyright Notice

© 2017 Daniel Ehrenberg, Yehuda Katz

Software License

All Software contained in this document ("Software") is protected by copyright and is being made available under the "BSD License", included below. This Software may be subject to third party rights (rights from parties other than Ecma International), including patent rights, and no licenses under such third party rights are granted under this license even if the third party concerned is a member of Ecma International. SEE THE ECMA CODE OF CONDUCT IN PATENT MATTERS AVAILABLE AT http://www.ecma-international.org/memento/codeofconduct.htm FOR INFORMATION REGARDING THE LICENSING OF PATENT CLAIMS THAT ARE REQUIRED TO IMPLEMENT ECMA INTERNATIONAL STANDARDS.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of the authors nor Ecma International may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE ECMA INTERNATIONAL "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ECMA INTERNATIONAL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.