-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Replacing 'state' with 'context' #1122
Labels
Comments
Rich-Harris
added a commit
that referenced
this issue
Feb 11, 2018
Rich-Harris
added a commit
that referenced
this issue
Feb 11, 2018
Rich-Harris
added a commit
that referenced
this issue
Feb 23, 2018
Implemented in 1.56 |
This was referenced Mar 14, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Context created by
each
andawait
blocks is reflected in additional function parameters, as seen here:Passing
cats[i]
andi
as arguments, and appending to those arguments for each new context, may not be the best idea. I think it probably makes it harder to extract certain chunks of code out into reusable helpers.I'd like to explore doing this instead:
(Note that
cat_index
is unused, and we could probably eliminate it altogether — probably easier withcontext
than with function args.)This does result in slightly larger code for the example above (1862 from 1786 bytes minified, 591 from 576 zipped, a 4%/2.5% increase), and it means extra allocations for all the child contexts (though maybe we could reuse child contexts?). But if it does mean that code can be reused more effectively (e.g. for diffing keyed lists) then it would probably pay for itself quite quickly. (Perf-wise too, since functions would warm up quicker in theory.)
My hunch is that this would be a step towards being able to offer different compilation modes, such as to Glimmer-style bytecode.
The text was updated successfully, but these errors were encountered: