Skip to content

Commit e7866cf

Browse files
committed
update README
1 parent 0a5d45d commit e7866cf

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Keys for Maps and Sets that represent a structured group of values.
44

55
## Status
66

7-
Stage: 1
7+
Stage: [1](https://tc39.es/process-document/)
88

99
Champion(s): [Ashley Claymore](https://github.com/acutmore)
1010

@@ -66,6 +66,9 @@ The downsides of this are:
6666

6767
Introduce built-in 'composite values' with well defined equality.
6868

69+
> [!IMPORTANT]
70+
> Expect changes. The design below is a starting point to evolve from as discussion continues.
71+
6972
```js
7073
const pos1 = Composite({ x: 1, y: 4 });
7174
const pos2 = Composite({ x: 1, y: 4 });
@@ -314,12 +317,7 @@ No. A composite is an object. It's `typeof` is `"object"`.
314317

315318
### Can composites be compared with `===` or `Object.is`?
316319

317-
There is no special behavior for composites with regards to `===` and `Object.is`.
318-
Like all objects they are only equal if they are compared to themselves.
319-
320-
While this means that composite equality is not universally triggered across the entire language it makes them significantly easier to implement in existing engines.
321-
322-
There is also performance expectations that `===` is fast, close to `O(1)` when composites have linear equality `O(n)`.
320+
Discussion continues in [issue 15](https://github.com/tc39/proposal-composites/issues/15).
323321

324322
### Why modify existing `Map` and `Set` semantics
325323

@@ -339,11 +337,11 @@ Let's discuss in [#4](https://github.com/acutmore/proposal-composites/issues/4).
339337

340338
### Why not a new protocol?
341339

342-
Why limit equality to only these composites values rather than let any object implement a new symbol protocol? The reason is reliability. To be able to participate as a `Map` key the equality must be pure, stable, and reliable, these guarantees would not come from a protocol that can execute arbitrary code. For example an object could have the symbol protocol added to it while it's in the map.
340+
Why limit equality to only these composites values rather than let any object implement a new symbol protocol? The reason is reliability. To be able to participate as a `Map` key the equality must be pure, stable, and reliable, these guarantees would not come from a protocol that can execute arbitrary code. For example: an object having the symbol protocol added to it while it's in the map.
343341

344342
### Syntax?
345343

346-
There could be syntax to make creating composites more ergonomic and cleaner to read.
344+
There could be syntax to make creating composites more ergonomic and cleaner to read. This would most likely be a separate, follow-on, proposal - after the Composites API has had time on its own in the ecosystem.
347345

348346
```js
349347
#{ x: 1 };
@@ -371,11 +369,13 @@ c[0]; // 1
371369
c[1]; // 4
372370
```
373371

374-
We instead encourage the components of the composite to be named to make the code easier to follow and avoid bugs where the indices are mixed up. We can see that this is how JavaScript is most commonly written today - code passes around objects with named properties rather than indexed lists.
372+
We instead encourage the constituents of the composite to be named to make the code easier to follow and avoid bugs where the indices are mixed up. We can see that this is how JavaScript is most commonly written today - code passes around objects with named properties rather than indexed lists.
375373

376374
### Why implement natively in the language?
377375

378-
Engines will have an advantage when it comes to implementing composites compared to user-land. Engines can access the existing hash value of objects and strings, and they can access the internals of `Map` and `Set`.
376+
Being able to create multi-value `Map` and `Set` keys is a common need across many application domains.
377+
378+
Additionally, engines will have an advantage when it comes to implementing composites compared to user-land. Engines can access the existing hash value of objects and strings, and they can access the internals of `Map` and `Set`.
379379

380380
### How does this compare to [proposal-richer-keys](https://github.com/tc39/proposal-richer-keys)?
381381

0 commit comments

Comments
 (0)