-
Notifications
You must be signed in to change notification settings - Fork 493
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
Compound operator expressions #915
Conversation
82466b4
to
6a03568
Compare
I don't actually know if the syntactic sugar is correct, so hopefully the lang team can sign off that it is in-deed correct. I also don't know if I can link to the test files without linking to Github, so I'm linking to Github. We could probably make linkcheck work for these eventually, if needed?
I can't answer if this is correct, but reading through it looks good to me (and #888 also still looks good to me).
It is not. If you want to leave the link in, I think that's fine, but we unfortunately don't currently have the ability to link-check external links, so there is some risk that it will become broken over time. |
@nikomatsakis Do you have bandwidth to review this? |
src/expressions/operator-expr.md
Outdated
<div class="warning"> | ||
|
||
Warning: The evaluation order of operands swaps depending on the types of the | ||
operands. Try not to write code that depends on the evaluation order of operands |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems sufficiently unusual to warrant further elaboration. The text above ("Otherwise, this expression is syntactic sugar ...") doesn't make it clear that because of that sugar, the evaluation order changes.
operands. Try not to write code that depends on the evaluation order of operands | |
operands: with primitive types the right-hand side will get evaluated first, while with non-primitive types the left-hand side will get evaluated first. Try not to write code that depends on the evaluation order of operands |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think the distinction got lost somewhere in the ten different ways I tried to formulate it before settling on this one. Adding it explicitly to the warning sounds good to me, so I did so.
I posted one comment seeking further clarification; other than that, this LGTM. r=me with that addressed. |
Update books ## nomicon 7 commits in a8584998eacdea7106a1dfafcbf6c1c06fcdf925..bbf06ad39d1f45654047e9596b750cc6e6d1b693 2021-01-06 12:49:49 -0500 to 2021-01-22 07:07:31 -0800 - Fix alloc link in exotic-sizes for local docs (rust-lang/nomicon#255) - Remove TODO - Fix small punctuation error - Arc revisions (Clone atomic explanation) (pt2/3(+?)) - Fix Arc Clone - Arc revisions (pt1/2(+?)) - Simple Arc implementation (without Weak refs) ## reference 5 commits in 50af691f838937c300b47812d0507c6d88c14f97..f02b09eb6e8af340ad1256a54adb7aae2ff3163e 2021-01-12 21:19:20 -0800 to 2021-01-22 01:53:02 -0800 - Fix missing space (rust-lang/reference#941) - Start documenting name resolution. (rust-lang/reference#937) - Fix plural and delete spurious words in comparison ops (rust-lang/reference#932) - Document execution order (rust-lang/reference#888) - Compound operator expressions (rust-lang/reference#915) ## book 3 commits in ac57a0ddd23d173b26731ccf939f3ba729753275..e724bd826580ff95df48a8533af7dec1080693d4 2021-01-09 14:18:45 -0500 to 2021-01-20 08:19:49 -0600 - Fixes rust-lang/book#2417. Get the index from user input instead of a const. (rust-lang/book#2566) - Turn off the playground in a bunch more lib.rs inclusions (rust-lang/book#2569) - Merge pull request rust-lang/book#2567 from rust-lang/rust-1.49 ## rust-by-example 1 commits in 03e23af01f0b4f83a3a513da280e1ca92587f2ec..f633769acef68574427a6fae6c06f13bc2199573 2021-01-09 10:20:28 -0300 to 2021-01-13 20:58:25 -0300 - Fixed styling on closure example (rust-lang/rust-by-example#1405)
Update books ## nomicon 7 commits in a8584998eacdea7106a1dfafcbf6c1c06fcdf925..bbf06ad39d1f45654047e9596b750cc6e6d1b693 2021-01-06 12:49:49 -0500 to 2021-01-22 07:07:31 -0800 - Fix alloc link in exotic-sizes for local docs (rust-lang/nomicon#255) - Remove TODO - Fix small punctuation error - Arc revisions (Clone atomic explanation) (pt2/3(+?)) - Fix Arc Clone - Arc revisions (pt1/2(+?)) - Simple Arc implementation (without Weak refs) ## reference 5 commits in 50af691f838937c300b47812d0507c6d88c14f97..f02b09eb6e8af340ad1256a54adb7aae2ff3163e 2021-01-12 21:19:20 -0800 to 2021-01-22 01:53:02 -0800 - Fix missing space (rust-lang/reference#941) - Start documenting name resolution. (rust-lang/reference#937) - Fix plural and delete spurious words in comparison ops (rust-lang/reference#932) - Document execution order (rust-lang/reference#888) - Compound operator expressions (rust-lang/reference#915) ## book 3 commits in ac57a0ddd23d173b26731ccf939f3ba729753275..e724bd826580ff95df48a8533af7dec1080693d4 2021-01-09 14:18:45 -0500 to 2021-01-20 08:19:49 -0600 - Fixes rust-lang/book#2417. Get the index from user input instead of a const. (rust-lang/book#2566) - Turn off the playground in a bunch more lib.rs inclusions (rust-lang/book#2569) - Merge pull request rust-lang/book#2567 from rust-lang/rust-1.49 ## rust-by-example 1 commits in 03e23af01f0b4f83a3a513da280e1ca92587f2ec..f633769acef68574427a6fae6c06f13bc2199573 2021-01-09 10:20:28 -0300 to 2021-01-13 20:58:25 -0300 - Fixed styling on closure example (rust-lang/rust-by-example#1405)
This is the final part of #248, split off from #888 since I have questions on this part and don't want to block #888 on it.
Specifically, is this desugaring correct? I asked on Zulip a few weeks ago, but got no definitive answer.
Also, is it possible to have a relative link to a test file?