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

Interaction with CompositeKey? #118

Closed
ajvincent opened this issue May 21, 2020 · 2 comments
Closed

Interaction with CompositeKey? #118

ajvincent opened this issue May 21, 2020 · 2 comments

Comments

@ajvincent
Copy link

I'm wondering if anything needs to be addressed for this proposal with regards to another Stage 1 proposal, RicherKeys' CompositeKey

@littledan
Copy link
Member

I'm having trouble seeing what could be addressed in this proposal. Records and Tuples satisfy some of the uses of CompositeKey, but CompositeKey could point to objects, so you'd need some additional thing (such as Symbols as WeakMap keys) to build something analogous. So, this might be considered to subsume that, but I don't see what we'd change in either proposal.

@acutmore
Copy link
Collaborator

acutmore commented Jul 8, 2022

Hi @ajvincent, thanks for the question.

As @littledan said, there does not appear to be anything that the R&T proposal will need to do in the context of the separate composite keys proposal.

Some use cases can be solved by either by a CompositeKey or a Record and Tuple. Other cases like hiding the contents of the key and use in WeakMap are 'built-in' to CompositeKey but can also be implemented on top of R&T + Symbols as WeakMap keys.

Here is a proof-of-concept of how a library could support Records & Tuples as WeakMap keys: https://gist.github.com/acutmore/d1aaaff27c898fdd26b2e15de5c2f7c6

@acutmore acutmore closed this as completed Jul 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants