-
Notifications
You must be signed in to change notification settings - Fork 47.9k
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
Incorrect handling of SequenceExpression inside XJSExpressionContainer #2143
Comments
What if we considered 2 a feature instead? It'd be rather close to facebook/jsx#8 and could turn out to be quite useful. Sequence expressions shouldn't make sense inside |
I'm not sure it's correct to change meaning and way the JS expressions are executed based purely on our own views on what and where would be useful. If someone wanted to emit concatenated content, one would use |
@RReverser Not saying I disagree, but |
They are not in JS, but with your assumption we're making those operators behave equally (both concatenate output). And that doesn't feel right, as we're changing the basic meaning of operators.
Probably, but good practice is always still just a good practice and not a reason to change language semantics and operator meanings. Everyone who wants, can still use parenthesis inside braces, but if we say in spec that |
Hmm? No they're not, I don't agree that we're changing basic meaning of operators, I'm not going to stand in the way, but to me |
|
I'm pretty sure that a sequence (known simply as Expression in the ES spec) is not included in AssignmentExpression. In fact, Expression is exactly just a sequence of AssignmentExpressions. I intentionally chose AssignmentExpression instead of Expression since I knew this wasn't supported. If we want to support this, let's open up a task on the JSX spec and have the discussion there so that other interested parties can follow along in the rationale. Leaving this bug open to chose either solution but, until we decide to fix the spec, the correct fix is to throw to a syntax error. |
You're right, my bad, sorry.
Makes sense, created an issue for tracking: facebook/jsx#17. Personally I prefer to allow any Expression inside braces and not throwing error as 1) we can do that easily and 2) personally for me throwing error where we can parse expression easily doesn't feel right (I just prefer less error-prone way). Would be interesting to hear thoughts of other parties though. |
Closing as non-actionable in this repo. |
@gaearon Ha, thanks for bringing up some old memories! |
Consider following examples:
or
Sequence expressions are not used that often, but still they are so I believe both possible errors should be fixed.
Possible fix would be to treat XJSExpressionContainer as parenthesized expression (simply add "(" and ")" around inner expression in output).
The text was updated successfully, but these errors were encountered: