Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Record and Tuple ECMAScript Proposal #518

Closed
1 task done
rricard opened this issue May 28, 2020 · 1 comment
Closed
1 task done

Record and Tuple ECMAScript Proposal #518

rricard opened this issue May 28, 2020 · 1 comment
Assignees
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

Comments

@rricard
Copy link

rricard commented May 28, 2020

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:

  • I have reviewed the TAG's API Design Principles
  • The group where the incubation/design work on this is being done (or is intended to be done in the future): @tc39
  • The group where standardization of this work is intended to be done ("unknown" if not known): @tc39
  • Existing major pieces of multi-stakeholder review or discussion of this design: TC39 Stage 1 consensus in October 2019; planning to ask for Stage 2 in July
  • Major unresolved issues with or opposition to this design:
    • JS developers seem excited about Records and Tuples; haven't heard widespread opposition overall
    • Should Record wrapper objects have a null prototype? #71. (Current proposal: yes)
    • How should === on Records and Tuples behave with floating point #65 (Current proposal: Records and Tuples are ==/=== if their contents are completely identical)
    • How can Records and Tuples point to objects? (Current proposal: to start, rely on solutions in JS; considering various approaches in a follow-on proposal )
    • How can entries in Records and Tuples be updated (Current proposal: See idioms in , potential follow-on proposal for deep updates https://github.com/rickbutton/proposal-record-deep-spread in development)
    • Minor: Name clashes with ECMA262 and WebIDL internal concepts of "record" (Current proposal: rename the ECMA262 and WebIDL concepts)
  • This work is being funded by: @bloomberg

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

@rricard rricard added Progress: untriaged Review type: CG early review An early review of general direction from a Community Group labels May 28, 2020
@rricard rricard changed the title Early review of Record and Tuple ECMAScript Proposal Record and Tuple ECMAScript Proposal May 28, 2020
@kenchris kenchris self-assigned this May 28, 2020
@kenchris kenchris added Topic: scripting ECMA, Web Assembly bindings, etc. Venue: TC39 labels May 28, 2020
@torgo torgo added this to the 2020-06-15-week milestone Jun 9, 2020
@hober
Copy link
Contributor

hober commented Jun 15, 2020

Hi,

We discussed this proposal in a TAG breakout today, and overall, we're really happy with this proposal. We're particularly impressed with the comprehensiveness of the explainer. We should consider adding a Glossary section to our explainer explainer based on your work here.

Prior to this TAG review, I noted the naming clash with WebIDL. We're confident that both you folks and WebIDL folks have that well in hand. We wonder if both WebIDL and TC39 could proactively look for such naming collisions when beginning new work.

Thanks so much for bringing this to us. If your design significantly changes due to other feedback, we'd love to take another look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

4 participants