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

Added section to specify that typeof will return a new value #23

Merged
merged 1 commit into from Jun 11, 2019

Conversation

Projects
None yet
3 participants
@rickbutton
Copy link
Collaborator

commented Jun 11, 2019

The actual value hasn't been decided on, but I added a section that describes that the typeof const objects/arrays is not object, but some other value (placeholder for now).

This will conflict with my other PRs, I will take care of rebasing etc when the time comes.

@rickbutton rickbutton changed the title Added small section to specify that typeof will return a new value Added section to specify that typeof will return a new value Jun 11, 2019

```js
assert(typeof @const { a: 1 } === "<placeholder>");
assert(typeof @const [1, 2] === "<placeholder>");

This comment has been minimized.

Copy link
@ljharb

ljharb Jun 11, 2019

if it's not an object (or a function), then that suggests it's a primitive. which means Object(x) === x needs to be false (and Object(x) needs to created a boxed object form of the primitive). Is that the plan?

This comment has been minimized.

Copy link
@rricard

rricard Jun 11, 2019

Owner

As explained in #22: Object(x) !== x, I think this is necessary otherwise, this will introduce a huge performance cliff in the engine if we implement structural sharing for const objects

@rickbutton rickbutton force-pushed the rb/typeof-placeholder branch from 6a164d4 to 4452b0e Jun 11, 2019

@rricard rricard merged commit 461672b into master Jun 11, 2019

@rricard rricard deleted the rb/typeof-placeholder branch Jun 11, 2019

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