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

Add info about wrapper objects #52

Merged
merged 6 commits into from Sep 12, 2019

Conversation

@mheiber
Copy link
Contributor

commented Sep 10, 2019

No description provided.

@mheiber

This comment has been minimized.

Copy link
Contributor Author

commented Sep 10, 2019

cc @ljharb for feedback if you have time.

Hope I got this right.

We'd like:

  • the instances of the wrapper objects to be immutable
  • to be consistent with the rest of JS as much as possible. This means not changing the semantics of . and [].

@mheiber mheiber force-pushed the mheiber:wrapper branch 3 times, most recently from b6859b9 to 091dae6 Sep 10, 2019

@rickbutton rickbutton requested a review from littledan Sep 10, 2019

README.md Outdated Show resolved Hide resolved

@mheiber mheiber force-pushed the mheiber:wrapper branch from 091dae6 to d43884e Sep 10, 2019

README.md Outdated
- `Object(record)` creates an instance of `Record`, which is the wrapper object for `record` values.
- `Object(tuple)` creates an instance of `Tuple`, which is the wrapper object for `tuple` values.

The `Record` prototype object is an ordinary object, is not a `Record` instance, and its prototype is `Object`.

This comment has been minimized.

Copy link
@littledan

littledan Sep 10, 2019

Collaborator

Probably you mean Object.prototype (and ditto below). Maybe start with "Record.prototype is..." for clarity.

README.md Outdated

`tuple` values are not an instances of the `Tuple` prototype. A `Tuple` instance can be created via `Object(tuple)`.

Accessing a member expression of a tuple or record via `.` or `[]` follows the standard [`GetValue`](https://www.ecma-international.org/ecma-262/#sec-getvalue) semantics, and implicitly converts to an instance of the corresponding wrapper type.

This comment has been minimized.

Copy link
@littledan

littledan Sep 10, 2019

Collaborator

Please link to tc39.es/ecma262/#sec-getvalue. Ecma publishes outdated snapshots.

This comment has been minimized.

Copy link
@littledan

littledan Sep 10, 2019

Collaborator

This section still should describe how those wrapped objects work, and why is it that they have the right properties. That's the interesting part!

This comment has been minimized.

Copy link
@mheiber

mheiber Sep 10, 2019

Author Contributor

@littledan I updated to make this part more interesting. I based the behavior of Tuple on that of String. Looking forward to seeing if I'm on the right track! Thanks for your time.

README.md Outdated Show resolved Hide resolved
mheiber and others added 3 commits Sep 10, 2019
correct typo
Co-Authored-By: Jordan Harband <ljharb@gmail.com>
@ljharb
ljharb approved these changes Sep 10, 2019
@mheiber

This comment has been minimized.

Copy link
Contributor Author

commented Sep 10, 2019

@champions: please do a 'squash and merge' rather than a straight merge if you can

@littledan
Copy link
Collaborator

left a comment

Please also mention that the wrapper objects are not extensible.

Accessing a member expression of a tuple or record via `.` or `[]` follows the standard [`GetValue`](https://tc39.es/ecma262/#sec-getvalue) semantics, and implicitly converts to an instance of the corresponding wrapper type.

An instance of `Record` has the same keys and values as the `record` value it was created from. These keys are all `writable: false, enumerable: true, configurable: false`.

This comment has been minimized.

Copy link
@robpalme

robpalme Sep 11, 2019

Collaborator

In addition, there is a length key.
->
In addition, there is a non-enumerable length key.

was updated to reflect review

@rricard rricard merged commit 0890de3 into rricard:master Sep 12, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.