Records

Concise syntax for prototype-less, immutable data structures with named properties.

Syntax

RecordLiteral ::= "#" "{" ("..." AssignmentExpression)? "}"
               |  "#" "{" PropertyDataAssignment ("," PropertyDataAssignment)* ("," "..." AssignmentExpression)? "}"

PropertyDataAssignment ::= PropertyName ":" AssignmentExpression

Semantics

  • typeof produces “record”
  • enumeration always proceeds in lexicographic order of property names
  • ellipsis form provides functional update: splices in own-properties of the result if typeof result is “object”, or properties if result of typeof result is “record”
  • record properties are immutable
  • == and === test value equality
  • < etc. test value order/equality
 
strawman/records.txt · Last modified: 2011/04/03 00:31 by brendan
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki