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

Implement stage 3 proposal globalThis #5885

Merged
merged 4 commits into from
Feb 1, 2019

Conversation

rhuanjl
Copy link
Collaborator

@rhuanjl rhuanjl commented Dec 19, 2018

This PR implements the stage 3 proposal globalThis.

  1. Actual implementation is 2 lines of code
  2. I've added a default enabled flag so it can be flagged off if ever necessary
  3. I've added a few tests which I think should be sufficient
  4. The large size of the diff is only due to it needing a byte code regen

cc: @ljharb @pleath

closes: #1658

Copy link
Collaborator

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM!

@ljharb ljharb mentioned this pull request Dec 19, 2018
31 tasks
@rhuanjl rhuanjl force-pushed the globalThis branch 4 times, most recently from 4484965 to 5b2093f Compare December 20, 2018 13:01
@fatcerberus
Copy link
Contributor

Hooray! 🎉

Going off on a tangent, I find the name of globalThis to be awkward; I understand why it was chosen (global, the best option, being dead in the water thanks to web compat), but a camelcased (pseudo)keyword is weird and it’s also somewhat ambiguous—as in strict mode (and modules), this is actually undefined when used in the global scope.

@ljharb
Copy link
Collaborator

ljharb commented Dec 20, 2018

@fatcerberus
Copy link
Contributor

fatcerberus commented Dec 20, 2018

Thanks, yeah, I understand the challenges around the proposal (I was very sad when global was ruled out), it’s mostly the ambiguity that gets to me in the end - since this is largely provided specifically so that strict-mode code can access the global easily (per the linked document), “global this” is a bit misleading - since the actual “global this” in strict mode is undefined (I think...)

@ljharb
Copy link
Collaborator

ljharb commented Jan 2, 2019

It'd be great to get this merged :-)

Copy link
Contributor

@boingoing boingoing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Also want to agree the name globalThis is an odd choice.

@boingoing
Copy link
Contributor

Hi @rhuanjl, would you mind rebasing this one? I will help merge it.

@rhuanjl
Copy link
Collaborator Author

rhuanjl commented Jan 27, 2019

I've noticed that there is an agenda item for the TC39 meeting due to be held this week to discuss changing the name of globalThis, should we hold off on getting this merged until after that discussion?

https://github.com/tc39/agendas/pull/511/files

@ljharb

@ljharb
Copy link
Collaborator

ljharb commented Jan 27, 2019

@rhuanjl Given that we already discussed it in November, and decided not to change the name, I find it highly unlikely that anything will change - in addition, Chrome and Safari are already both shipping under the current name.

It's up to yall of course, but I'd suggest merging as-is, and in the unlikely event of a name change, it can be updated.

@rhuanjl
Copy link
Collaborator Author

rhuanjl commented Jan 31, 2019

@ljharb I can see (from it being crossed out on the agenda) that the name change discussion has taken place - can you tell us if the name is being changed/is likely to be?

@ljharb
Copy link
Collaborator

ljharb commented Jan 31, 2019

@rhuanjl there was not consensus for any change, no.

@rhuanjl
Copy link
Collaborator Author

rhuanjl commented Jan 31, 2019

@boingoing as per @ljharb's comment it sounds like the name won't be changing. I've rebased on latest master, ok to merge?

@boingoing
Copy link
Contributor

@rhuanjl Yup, I'll run the change through our internal test suites and merge it when it's green.

@chakrabot chakrabot merged commit 22940fd into chakra-core:master Feb 1, 2019
chakrabot pushed a commit that referenced this pull request Feb 1, 2019
Merge pull request #5885 from rhuanjl:globalThis

This PR implements the stage 3 proposal globalThis.

1. Actual implementation is 2 lines of code
2. I've added a default enabled flag so it can be flagged off if ever necessary
3. I've added a few tests which I think should be sufficient
4. The large size of the diff is only due to it needing a byte code regen

cc: @ljharb @pleath

closes: #1658
@boingoing
Copy link
Contributor

@rhuanjl Took the liberty of rebasing and adding a new bytecode GUID into your branch. Hope you don't mind. Landed via 5d83d3e

Thanks very much for the submission. Always nice to see your contributions.

@rhuanjl rhuanjl deleted the globalThis branch February 1, 2019 18:13
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

Successfully merging this pull request may close these issues.

Implement global.global
5 participants