Skip to content

add evocative examples for Shl and Shr #35863

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Aug 30, 2016

Conversation

matthew-piziak
Copy link
Contributor

@aravind-pg
Copy link
Contributor

IMO this is a nice but unnecessarily sophisticated example, since the implementation involves some distractingly nontrivial vector manipulation. For documentation purposes is it not enough to just have say a struct Scalar(i64) with the obvious Shl/Shr implementation? After all the purpose here shouldn't be to suggest fun ideas for a Shl/Shr implementation but rather just to show concisely how it is done :)

@matthew-piziak
Copy link
Contributor Author

@aravind-pg Yeah, that's a good point. I've added the examples you suggested. Do you think something like SpinVector has value as a secondary example?

@aravind-pg
Copy link
Contributor

Sure, I personally quite like it, but I'm not sure what the policy is on having two separate examples in the documentation (I would think it leans towards a no, in the interest of brevity).

@steveklabnik
Copy link
Member

In general, more examples are good; brevity isn't always a good thing when it comes to docs. There's obviously some kind of limit to this.

On Aug 21, 2016, 00:26 -0400, Aravind Gollakota notifications@github.com, wrote:

Sure, I personally quite like it, but I'm not sure what the policy is on having two separate examples in the documentation (I would think it leans towards a no, in the interest of brevity).


You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub (#35863 (comment)), or mute the thread (https://github.com/notifications/unsubscribe-auth/AABsitl01_34vXWAQ-GCg0MfqwfP0Vgwks5qh9OMgaJpZM4JpJhT).

@matthew-piziak
Copy link
Contributor Author

Working on this PR started to feel like this after a while:

https://www.youtube.com/watch?v=1pAMdn9oSPE

r? @steveklabnik

add examples that lift `<<` and `>>` to a trivial struct

replace `Scalar` structs with struct tuples

add `fn main` wrappers to enable Rust Playground "Run" button
@steveklabnik
Copy link
Member

Looks great, thanks!

@bors: r+ rollup

@bors
Copy link
Collaborator

bors commented Aug 25, 2016

📌 Commit ff3a761 has been approved by steveklabnik

steveklabnik added a commit to steveklabnik/rust that referenced this pull request Aug 25, 2016
…klabnik

add evocative examples for `Shl` and `Shr`

r? @steveklabnik
steveklabnik added a commit to steveklabnik/rust that referenced this pull request Aug 26, 2016
…klabnik

add evocative examples for `Shl` and `Shr`

r? @steveklabnik
steveklabnik added a commit to steveklabnik/rust that referenced this pull request Aug 26, 2016
…klabnik

add evocative examples for `Shl` and `Shr`

r? @steveklabnik
Manishearth added a commit to Manishearth/rust that referenced this pull request Aug 27, 2016
…klabnik

add evocative examples for `Shl` and `Shr`

r? @steveklabnik
@bors
Copy link
Collaborator

bors commented Aug 29, 2016

⌛ Testing commit ff3a761 with merge a06c27e...

@bors
Copy link
Collaborator

bors commented Aug 29, 2016

💔 Test failed - auto-mac-64-opt-rustbuild

@arielb1
Copy link
Contributor

arielb1 commented Aug 29, 2016

@bors retry

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Aug 29, 2016
…klabnik

add evocative examples for `Shl` and `Shr`

r? @steveklabnik
bors added a commit that referenced this pull request Aug 29, 2016
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Aug 30, 2016
…klabnik

add evocative examples for `Shl` and `Shr`

r? @steveklabnik
bors added a commit that referenced this pull request Aug 30, 2016
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Aug 30, 2016
…klabnik

add evocative examples for `Shl` and `Shr`

r? @steveklabnik
bors added a commit that referenced this pull request Aug 30, 2016
@bors bors merged commit ff3a761 into rust-lang:master Aug 30, 2016
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants