-
Notifications
You must be signed in to change notification settings - Fork 695
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
Short-circuiting conditionals (&&, ||) #78
Comments
+1 I also suggested that the polyfill should use short-circuit. This implies either adding them to asm.js (I remember discussing this with @sunfishcode and @kripken, but can't recall the outcome), or having the polyfill not be strictly asm.js. |
Polyfill isn't a problem because |
Ah, so ternaries work in asm.js but not && or ||? Interesting, less problematic. |
Also worth noting is that when we implement the CFG structuring technique described in #44, the problem of complicated control flow will be reduced in general. |
Consensus is that we have statements = expressions, so building short-circuiting conditionals can be done pretty easilly. |
Where is the discussion leading to statements = expressions? I must have missed it. |
Even without stmts=exprs, AstSemantics.md currently has a ternary. asm.js does not have short-circuiting because ternary was sufficient. |
More generally, we have an open issue on statements =?= expressions, #223, which does not have any conclusion, nor any activity for almost 4 months. That's why I'm surprised to hear @titzer say "Consensus is that we have statements = expressions". (No concerns from me on closing this particular issue about && and ||.) |
In a discussion about control flow it came up that asm.js currently doesn't support && or ||. The resulting control flow trees are pretty complicated sometimes. I think we should make sure short-circuiting boolean logic is expressible in webasm so that the resulting AST is denser and shallower. Thoughts?
EDITED: clarity
The text was updated successfully, but these errors were encountered: