-
Notifications
You must be signed in to change notification settings - Fork 358
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
Do Expressions #155
Comments
Seems fairly straightforward to me. @dherman any footguns to be aware of? @RReverser and @ariya any thoughts? |
I haven't investigated do expressions yet. BTW, why is the type |
One of the major controversies with the proposal within the committee is whether abrupt completions such as return/break/continue statements should be allowed within do expressions. |
Seems like a copy-paste mistake to me. |
Oops, fixed (good catch @ariya) |
Don't you mean |
@gibson042, isn't the body of a do Expression just a normal block for the case of tree representation? |
Yes, subject to the concerns about completions @michaelficarra mentioned. But |
The body is a blockStatement (subject to abrupt completions), the type is "DoExpression"... no? what am I missing? |
@mikesherov I think when @gibson042 wrote his previous comment
main type of node was "BlockStatement", but @hzoo edited it afterwards, so it's now "DoExpression", thus misunderstanding :) |
Babel docs: http://babeljs.io/docs/plugins/transform-do-expressions
Stage 1 gist reproduced below: https://gist.github.com/dherman/1c97dfb25179fa34a41b5fff040f9879 by @dherman
In Babel
Motivation
Examples
Write in an expression-oriented style, scoping variables as locally as possible:
Use conditional statements as expressions, instead of awkward nested ternaries:
Especially nice for templating languages like JSX:
The text was updated successfully, but these errors were encountered: