Record and Tuple ECMAScript Proposal #518
Labels
Review type: CG early review
An early review of general direction from a Community Group
Topic: scripting
ECMA, Web Assembly bindings, etc.
Venue: TC39
Milestone
Hello TAG!
I'm requesting a TAG review of Record & Tuple.
This proposal introduces two new deeply immutable data structures to JavaScript:
Record
, a deeply immutable Object-like structure#{ x: 1, y: 2 }
Tuple
, a deeply immutable Array-like structure#[1, 2, 3, 4]
Records and Tuples can only contain primitives and other Records and Tuples. You could think of Records and Tuples as "compound primitives". By being thoroughly based on primitives, not objects, Records and Tuples are deeply immutable.
Records and Tuples support comfortable idioms for construction, manipulation and use, similar working with objects and Arrays. They are compared deeply by their contents, rather than by their shallow identity.
JavaScript engines may perform certain optimizations on construction, manipulation and comparison of Records and Tuples, analogous to the way Strings are often implemented in JS engines. (It should be understood, these optimizations are not guaranteed.)
Records and Tuples aim to be usable and understood with external typesystem supersets such as TypeScript or Flow.
Further details:
You should also know that...
We are interested where you would think that Record and Tuple would be a good fit for Web APIs and what work and/or precisions you'd need from us to use it. Please note that at the moment we do not have a way to create something analoguous to classes in that proposal. THis is being considered as a potential follow-on proposal.
We'd prefer the TAG provide feedback as:
🐛 open issues in our GitHub repo for each point of feedback
The text was updated successfully, but these errors were encountered: