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

Explain the --bin flag more clearly #24495

Merged
merged 1 commit into from
Jun 12, 2015
Merged

Explain the --bin flag more clearly #24495

merged 1 commit into from
Jun 12, 2015

Conversation

nathanl
Copy link
Contributor

@nathanl nathanl commented Apr 16, 2015

Explain the --bin flag in terms of the difference
between shipping binary and library code

I'm not sure if my explanation is even quite correct, but as a newbie coming from Ruby, this is my best guess. (In Rubyland, libraries always ship with the source code because there's no other form you can ship. :) )

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @huonw (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see CONTRIBUTING.md for more information.

@steveklabnik
Copy link
Member

This is not accurate, actually. Libraries are also compiled, and can be distributed sans source.

The difference is more like 'are you shipping an application or a library?'

@nathanl
Copy link
Contributor Author

nathanl commented Apr 17, 2015

So is the difference a question of what files need to be generated?

@nathanl
Copy link
Contributor Author

nathanl commented Apr 17, 2015

I just ran it both ways. With --bin, the new project's /src contains main.rs with

fn main() {
    println!("Hello, world!");
}

Without --bin, the new project's src/ contains lib.rs with

#[test]
fn it_works() {
}

Maybe it's silly to explain why at this point in the guide, I just found the flag confusing. --bin made me think "binary", which made me think "compiled", so I thought, "without that, we're going to skip compiling something?"

I'm only bugging you in the hopes that I'm a representatively confused newbie. 😄 Feel free to close / ignore if you think this isn't useful.

@huonw
Copy link
Member

huonw commented Apr 21, 2015

r? @steveklabnik

@rust-highfive rust-highfive assigned steveklabnik and unassigned huonw Apr 21, 2015
@steveklabnik
Copy link
Member

No, I think it's worth explaining, since 'binary' is overloaded here, but we want to use it to explain why it's --bin. I'm still not sure what the right way to re-word it is.

@steveklabnik
Copy link
Member

@nathanl any thoughts here?

@nathanl
Copy link
Contributor Author

nathanl commented May 15, 2015

The difference is more like 'are you shipping an application or a library?'

If that's the distinction, I don't think there's a good way to say "--bin actually means 'application'" - it's the flag itself that's confusing. The real fix would be for cargo to deprecate --bin in favor of --app.

Short of that, maybe the docs should just acknowledge "this flag is confusingly-named, but you use --bin when you want to make a standalone application as opposed to a library." And possibly, "It will be compiled to a binary in the end either way."

@steveklabnik
Copy link
Member

I mean, calling compiled programs 'binaries' has a loooong history. It's just a word that's overloaded due to context.

@richo
Copy link
Contributor

richo commented May 18, 2015

Maybe referencing bin/ and lib/ in the posixfs layout?

On Monday, May 18, 2015, Steve Klabnik notifications@github.com wrote:

I mean, calling compiled programs 'binaries' has a loooong history. It's
just a word that's overloaded due to context.


Reply to this email directly or view it on GitHub
#24495 (comment).

@nathanl
Copy link
Contributor Author

nathanl commented May 20, 2015

I mean, calling compiled programs 'binaries' has a loooong history. It's just a word that's overloaded due to context.

Yep, you're right, and so is @richo. How about saying something like "We're passing --bin because our goal is to get straight to making an executable application, as opposed to a library. Executables are often called "binaries" (as in /usr/bin, if you're on a Unix system)."

@steveklabnik
Copy link
Member

@nathanl that sounds good to me. Are you interested in updating this PR? Sorry that it got lost in the shuffle :(

@nathanl
Copy link
Contributor Author

nathanl commented Jun 9, 2015

@steveklabnik Yep, updated. 😄

@steveklabnik
Copy link
Member

Awesome! This looks great, with a few smallll details: single quotes should be used for emphasis in this way, not double quotes. And, they should be curly quotes, and the period should move. :) I know these quotes can be weird, so here's the text, if you don't want to figure out how to type them: https://gist.github.com/steveklabnik/0ab6e31bb638263c196b

After that, let's get this merged! Sorry it's been so nitpicky :(

@nathanl
Copy link
Contributor Author

nathanl commented Jun 11, 2015

No problem. I've made the tweaks and would like to squash my commits down to one, but so far I've just done edits straight from the Github interface and have to clone the project to do the squash. 41k commits take a while to clone... 😄

@nathanl
Copy link
Contributor Author

nathanl commented Jun 11, 2015

@steveklabnik Squashed and ready to merge!

@steveklabnik
Copy link
Member

@bors: r+ rollup

@bors
Copy link
Contributor

bors commented Jun 11, 2015

📌 Commit a47d7a7 has been approved by steveklabnik

@steveklabnik
Copy link
Member

Thanks so much!

@bors
Copy link
Contributor

bors commented Jun 12, 2015

⌛ Testing commit a47d7a7 with merge 8d24f83...

@bors
Copy link
Contributor

bors commented Jun 12, 2015

💔 Test failed - auto-linux-32-opt

@alexcrichton
Copy link
Member

@bors: retry

On Thu, Jun 11, 2015 at 9:38 PM, bors notifications@github.com wrote:

[image: 💔] Test failed - auto-linux-32-opt
http://buildbot.rust-lang.org/builders/auto-linux-32-opt/builds/5327


Reply to this email directly or view it on GitHub
#24495 (comment).

@bors
Copy link
Contributor

bors commented Jun 12, 2015

⌛ Testing commit a47d7a7 with merge b3a2a1c...

Manishearth added a commit to Manishearth/rust that referenced this pull request Jun 12, 2015
…=steveklabnik

Explain the --bin flag in terms of the difference
between shipping binary and library code

I'm not sure if my explanation is even quite correct, but as a newbie coming from Ruby, this is my best guess. (In Rubyland, libraries always ship with the source code because there's no other form you can ship. :) )
@bors
Copy link
Contributor

bors commented Jun 12, 2015

⛄ The build was interrupted to prioritize another pull request.

bors added a commit that referenced this pull request Jun 12, 2015
@bors bors merged commit a47d7a7 into rust-lang:master Jun 12, 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.

7 participants