Skip to content
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

TRPL: guessing game #25080

Merged
merged 1 commit into from May 6, 2015
Merged

TRPL: guessing game #25080

merged 1 commit into from May 6, 2015

Conversation

steveklabnik
Copy link
Member

This also made me realize that I wasn't using the correct term,
'associated functions', rather than 'static methods'. So I corrected
that in the method syntax chapter.

@rust-highfive
Copy link
Collaborator

r? @pcwalton

(rust_highfive has picked a reviewer for you, use r? to override)

@steveklabnik steveklabnik assigned alexcrichton and unassigned pcwalton May 3, 2015
the guessing game. Here’s how it works: Our program will generate a random
integer between one and a hundred. It will then prompt us to enter a guess.
Upon entering our guess, it will tell us if we’re too low or too high. Once we
guess correctly, it will congratulate us. Sound good?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sound good?

Sounds good?

@killercup
Copy link
Member

Good read. I've added a few comments for questions and typos. Feel free to ignore my stylistic suggestions :)

@steveklabnik
Copy link
Member Author

Thanks @killercup and @parir ! nits addressed


# Generating a secret number

Next, we need to generate a secret number. Rust does not include random
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps "does not yet"? (we do plan on including it one day)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's hard. Text like that tends to get out of date, though I guess this phrasing does too. Hrm.

@alexcrichton
Copy link
Member

Amazing @steveklabnik!

Only a few stylistic nits from me, but otherwise r=me

@steveklabnik
Copy link
Member Author

Woot! About to board a plane, but I'll get on it tomorrow. I gotta get used to linking to more docs :)

rather than do all the work of figuring out versions again. This lets you
have a repeatable build automatically.

What about when we _do_ want to use `v0.4.0`? Cargo has another command,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NB. if the code above is changed to rand = "0.3" this section will need updating.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will it? rand = 0.3 will use 0.4 when it comes out, just like this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The specification "0.3" to cargo indicates "0.3 compatible" and because 0.4 is not compatible with 0.3 it won't automatically pick it up (e.g. I believe @huonw is correct here)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"0.3.0" is shorthand for "^0.3.0" still, right? That should pick up 0.4.0, to be compatible with ^ requirements. It won't pick up a 1.0.0.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but 0.3.0 is not semver compatible with 0.4.0, so it won't pick it up

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where's this behavior documented? Breaking ^ seems really bad :/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cargo takes 0.x to be the major releases for 0. versions, otherwise there wouldn't be a way to make incompatible releases other than going straight to 1.0. (docs)

In fact, strictly speaking even this is different to what semver really is:

Major version zero (0.y.z) is for initial development. Anything may change at any time. The public API should not be considered stable.

I.e. 0.3.1 is "meant" to be not compatible with 0.3.2, although I prefer our scheme.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha. Ouch :/ well, i'll write a patch for this later today, since this PR was merged. Thanks you two!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This particular function returns a handle to the standard input for your
terminal. More specifically, a [std::io::Stdin][iostdin].

[stdin]: http://doc.rust-lang.org/nightly/std/io/struct.Stdin.html
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reference and the above don't match (iostdin vs stdin) and this should use a relative path (../std/io/struct.Stdin.html).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch

@steveklabnik
Copy link
Member Author

@bors: r=alexcrichton rollup

@bors
Copy link
Contributor

bors commented May 5, 2015

📌 Commit ef1a123 has been approved by alexcrichton

steveklabnik added a commit to steveklabnik/rust that referenced this pull request May 5, 2015
…richton

This also made me realize that I wasn't using the correct term,
'associated functions', rather than 'static methods'. So I corrected
that in the method syntax chapter.
bors added a commit that referenced this pull request May 5, 2015
This also made me realize that I wasn't using the correct term,
'associated functions', rather than 'static methods'. So I corrected
that in the method syntax chapter.
@steveklabnik
Copy link
Member Author

@bors: r=alexcrichton rollup

@bors
Copy link
Contributor

bors commented May 5, 2015

📌 Commit 9d512fd has been approved by alexcrichton

steveklabnik added a commit to steveklabnik/rust that referenced this pull request May 5, 2015
…richton

This also made me realize that I wasn't using the correct term,
'associated functions', rather than 'static methods'. So I corrected
that in the method syntax chapter.
bors added a commit that referenced this pull request May 5, 2015
@bors bors merged commit 9d512fd into rust-lang:master May 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants