-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Specification of ! and + unary operators is unclear #359
Comments
I would expect !x to behave exactly like: (x? false: true) Added Area-Language, Triaged labels. |
I've now spec'ed both, but will move to eliminate unary + altogether. I don't know what we have unary + for. It is a no-op (for all types) and serves no purpose. FWIW, in JS, +"abc" evaluates to NaN! Added Done label. |
This comment was originally written by [email protected] Thanks for clarifying! Are you sure that you don't want us to implement + (non-number) -> NaN? It seems like such a valuable feature that I don't know why we would leave it out of dart <smile>. +1 to making + go away completely. Minor suggestion. I would have found it easier to find the new spec rules if both + and ! were defined in the same clause either under prefixExpression or unaryExpression. |
This issue was originally filed by [email protected]
These two operators are allowed to be used in a unary expression, but they are not allowed to be user defined. I could not find a definition in the spec for how they are supposed to behave. Here are the rough rules that I am assuming until I hear something more definitive:
Thanks for any help clarifying the behavior of these operators.
The text was updated successfully, but these errors were encountered: