Live data from Hacker News

Cargo, Rust's Package Manager

crates.io

11–20 of 127 posts

Re: Cargo, Rust's Package Manager

#11

Why not just use JSON? Infact, why not just use npm's package.json?

I think that's a good point. Why use .toml when we have better alternatives already? (I admit I have a bias against toml, but still...)

Which ones would that be?

Re: Cargo, Rust's Package Manager

#12
post #8

How do you pin a dependency to a particular version or git sha? I can't find anything in the FAQ or docs that implies that it's possible.

From announcement email:

The next features we're planning on working on are: - Supporting refs other than `master` from git packages

Re: Cargo, Rust's Package Manager

#13
post #4

Why not just use JSON? Infact, why not just use npm's package.json?

I may not be a majority here, but I see JSON as a data transportation format, while I see TOML or YAML as configuration formats. You cannot write comments in JSON, for instance.

Valid JSON: { comment: "The comment." }

Re: Cargo, Rust's Package Manager

#14
I would really love to see some docs on how to actually install and get started with Cargo.

It doesn't ship with Rust and the docs on GitHub and crates.io are not very enlightening.

Re: Cargo, Rust's Package Manager

#15
post #14

I would really love to see some docs on how to actually install and get started with Cargo. It doesn't ship with Rust and the docs on GitHub and crates.io are not very enlightening.

This was how I installed it (Mac):

  1) Install latest version of Rust found here: http://www.rust-lang.org
  2) git clone --recursive git@github.com:rust-lang/cargo.git
  3) make
  4) make install (could be that sudo is needed for you)

Re: Cargo, Rust's Package Manager

#17
post #15
post #14

I would really love to see some docs on how to actually install and get started with Cargo. It doesn't ship with Rust and the docs on GitHub and crates.io are not very enlightening.

This was how I installed it (Mac): 1) Install latest version of Rust found here: http://www.rust-lang.org 2) git clone --recursive git@github.com:rust-lang/cargo.git 3) make 4) make install (could be that sudo is needed for you)

I'm putting rust in $HOME/bin (and other self compiled software). You can change the default installation from /usr/local by running

  DESTDIR=$HOME make install

Re: Cargo, Rust's Package Manager

#18
post #4

Why not just use JSON? Infact, why not just use npm's package.json?

I may not be a majority here, but I see JSON as a data transportation format, while I see TOML or YAML as configuration formats. You cannot write comments in JSON, for instance.

Example from the website in json

    {
      'package': {
         'name': 'hello-world',
         'version': '0.1.0',
         'authors': [ 'wycats@example.com' ]
      },
      'bin': {
        'name': 'hello-world',
        'comment': 'the name of the executable to generate'
      }
    }
So where is the problem ?

And you have the advantage, that other tools can use the complete file including the comment. In TOML you need an extra parser to grab the comment.

Re: Cargo, Rust's Package Manager

#20
post #18
post #4

Earlier quoted context omitted.

I may not be a majority here, but I see JSON as a data transportation format, while I see TOML or YAML as configuration formats. You cannot write comments in JSON, for instance.

Example from the website in json { 'package': { 'name': 'hello-world', 'version': '0.1.0', 'authors': [ 'wycats@example.com' ] }, 'bin': { 'name': 'hello-world', 'comment': 'the name of the executable to generate' } } So where is the problem ? And you have the advantage, that other tools can use the complete file including the comment. In TOML you need an extra parser to grab the comment.

I don't really care what format the cargo files use (that's just an inconsequential bikeshed as far as I'm concerned) but in your example "comment" is really not a comment. I would expect to be able to put free-form comments anywhere I want and have them thrown away by the parser.

Your solution works fine for docstrings, but comments and docstrings are not the same thing (although many languages that don't support docstrings in the syntax hack them together using comments, admittedly).

But beyond that, what's the argument for switching to json? Is there some kind of intercompatibility with npm/Node.js to be gained?

Post reply on HN