Skip to content

do not export getValue and setValue by default #5839

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

Merged
merged 11 commits into from
Dec 1, 2017
Merged

Conversation

kripken
Copy link
Member

@kripken kripken commented Nov 23, 2017

Also add a mechanism in ASSERTIONS that emits stubs that give an error message, so if a user depended on those being exported, in ASSERTIONS they get a clear error message.

…SERTIONS that emits stubs that give an error message, so if a user depended on those being exported, in ASSERTIONS they get a clear error message
@curiousdannii
Copy link
Contributor

curiousdannii commented Nov 23, 2017

If I have a custom library file, will replacing getValue with {{{ makeGetValue }}} ensure it still works?

Edit: no I see that it outputs code to directly access the HEAP array. Even better!

@kripken
Copy link
Member Author

kripken commented Nov 23, 2017

Better than that, actually, it will still work without you doing anything :) We do still initially emit getValue, this PR just makes us not export it, and the JSDCE optimization pass will only remove a function that is neither exported nor used.

(That's true for a custom js library file, or any other code that gets optimized with the other JS. But if you use it from outside, you should be using Module.getValue anyhow.)

I changed that one direct use of getValue to {{{ makeGetValue .. }}} in this PR because the macro will emit a direct heap access - so it no longer references getValue and will not keep it alive. But if you add a direct use of getValue in your code, it's fine, the function will not get removed.

@kripken
Copy link
Member Author

kripken commented Nov 24, 2017

Added some test fixes and improvements, and verified this passes all the tests locally, should be good to go.

@juj
Copy link
Collaborator

juj commented Nov 25, 2017

lgtm, I think this is exactly the direction we want to go, this will help developers explicitly make the choices what to include in.

@kripken
Copy link
Member Author

kripken commented Nov 25, 2017

Thanks @juj. Before merging I'll mention this on the mailing list too for feedback. And I added a Changelog update for this as suggested by @curiousdannii in #5836 (comment)

@kripken
Copy link
Member Author

kripken commented Dec 1, 2017

Just to be safe I waited for feedback an extra week after the lgtm here because this is the first of the breaking changes we've been discussing. Also discussion on the mailing list has been in support. Merging.

@kripken kripken merged commit ccc7803 into incoming Dec 1, 2017
@kripken kripken deleted the getSetValue branch December 1, 2017 21:36
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.

3 participants