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

Kill keyOf :) #7615

Merged
merged 1 commit into from
Aug 30, 2016
Merged

Kill keyOf :) #7615

merged 1 commit into from
Aug 30, 2016

Conversation

vjeux
Copy link
Contributor

@vjeux vjeux commented Aug 30, 2016

See discussion here for the rationale: https://www.facebook.com/groups/2003630259862046/permalink/2097088000516271/

It doesn't have a big effect on file size:

screen shot 2016-08-30 at 10 31 49 am

@@ -55,7 +54,7 @@ var mouseDown = false;
// Track whether a listener exists for this plugin. If none exist, we do
// not extract events. See #3639.
var hasListener = false;
var ON_SELECT_KEY = keyOf({onSelect: null});
var ON_SELECT_KEY = 'onSelect';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Might inline this one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

@gaearon
Copy link
Collaborator

gaearon commented Aug 30, 2016

Accepted with nits.
If you’d like to do those bonus things, could do separately in another PR.

@vjeux
Copy link
Contributor Author

vjeux commented Aug 30, 2016

Inline the two, going to try your other suggestion in a separate PR

@vjeux vjeux added this to the 15-next milestone Aug 30, 2016
@vjeux vjeux merged commit f7076b7 into facebook:master Aug 30, 2016
@milesj
Copy link
Contributor

milesj commented Aug 30, 2016

I'm curious why keyOf was even a thing to begin with?

@gaearon
Copy link
Collaborator

gaearon commented Aug 30, 2016

Google Closure Compiler has an “advanced optimizations” mode that mangles var x = { hello: 'world' }; console.log(x.hello); to var x = { a: 'world' }; console.log(x.a);. As you can see, any dynamic access like var key = 'hello'; console.log(x[key]) with such optimizations would be broken, so we tried to use keyOf() to retrieve the mangled key. However it turned out that GCC advanced mode compatibility was broken a long time ago, and nobody used it.

@zpao zpao modified the milestones: 15-next, 15.4.0 Oct 4, 2016
zpao pushed a commit that referenced this pull request Oct 4, 2016
(cherry picked from commit f7076b7)
jscissr added a commit to jscissr/react-polymer that referenced this pull request Jun 14, 2017
It was removed in React: facebook/react#7615
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants