Cargo: Allow `cargo.toml`

Created on 24 Jun 2014  Â·  27Comments  Â·  Source: rust-lang/cargo

From http://www.reddit.com/r/rust/comments/28xyrc/cargo_alpha_is_here/cifnlkg

Would be nice to be consistent with make, and while I prefer Cargo.toml, apparently a bunch of people feel the other way.

Most helpful comment

+1 for Cargofile or cargo.toml. Cargo.toml is a weird merging of two conventions.

All 27 comments

I'd say a standard is better than everyone doing as they want.

Agreed. Cargo.toml feels a bit unnatural when all other files are lowercased.

@tbu- normally, I'd agree with you, but we also have to consider case-insensitive filesystems.

@steveklabnik Fair point.

I have started looking into this.

@steveklabnik Do we want to be case-insensitive for so we can support case-insensitive systems or do we simply want to allow Cargo.toml and cargo.toml ?

I personally feel we should do what make does: look for a cargo.toml and then a Cargo.toml. I'd like to hear @wycats 's thoughts though.

Capital letters group it together with other similar configuration files and avoids it from being interspersed with other files and directories.

@wycats I know in Ruby I'm used to seing Gemfile, Rakefile and other files with a leading capital letter.

There are many possible conventions.

Another one is dot files with a prefixed dot followed by all lowercase letters.
Make seems to use all lowercase letters by default with no dot.
I'm also used to seeing .yml or .json config files all in lower case.

So I guess there's a lot of different styles. I would be partial to allowing cargo.toml but it wouldn't bother me either way as a Cargo user.

Tell me guys if we should continue with this one or if we should close it and keep the current convention.

If we go ahead I'll try and make a patch.

You don't want a leading . because that cuts against the grain of the git CLI.

I'd rather stick with the current convention, for the reasons I described. We can revisit this if it causes real problems.

Capital letters group it together with other similar configuration files

What other configuration files?

@bjz id imagine Rakefile, Makefile, Gemfile at least. Notice that none of these have file extensions, whereas Cargo.toml does.

Id prefer cargo.toml or Cargofile. It is strange to have the capitalized word _and_ the file extension.

Cargofile is more to 'convention' than @wycats's argument. Config files with file extensions such as 'setup.py', 'project.clj' and 'pom.xml' all start with lowercase. Cargo's approach seems to be actually _most_ against the current convention than anything I have seen so far.

+1 for Cargofile or cargo.toml. Cargo.toml is a weird merging of two conventions.

Another +1 for the proposed compromise — Cargofile or cargo.toml — rather than the current Cargo.toml. I can't think of a single other language that follows the Capitalized + extension convention for non-source files.

I agree with making it lower cased. In general, build system file names either match ^[A-Z][a-z]+file$ or ^[a-z]+\.[a-z]+$. It isn't very common to use a mix of both. The only exception I can think of is CMake but I think that was designed in Windows land where everything needs a file extension.

You don't want a leading . because that cuts against the grain of the git CLI.

@wycats - How so? In my projects, I have .gitignore, .jshintrc and other dot-prefixed files. They seem to behave as any other named file from my experience.

Another +1 for the proposed compromise — Cargofile or cargo.toml — rather than the current Cargo.toml. I can't think of a single other language that follows the Capitalized + extension convention for non-source files.

I agree. I would prefer cargo.toml, but wouldn't complain too loudly against Cargofile. Nearly every configuration file I use is lowercase (granted, without an extension), and there's already precedent for ^[a-z]+\.[a-z]+$ (among others already mentioned):

  • npm: package.json
  • bower: bower.json (which admittedly is probably following npm's lead)
  • cabal: <project>.cabal (e.g. cargo.cabal)
  • luarocks: <project>-<version>.rockspec
  • ant: build.xml

I'm sure there are more examples for both sides, but I don't think there's an argument for saying ^[a-z]+\.[a-z]+$ is any less standard than ^[A-Z][a-z]+\.[a-z]+$. There _is_, however, precedent for lower-case filenames in Rust and on case-sensitive filesystems, and it doesn't matter as much for case-insensitive filesystems, so the preference (IMHO) should go to the more restrictive environment.

I haven't used a case-insensitive filesystem for years, so I'm a bit out-of-the-loop in terms of conventions there, so I could be missing something important.

@wycats

Capital letters group it together with other similar configuration files and avoids it from being interspersed with other files and directories.

I don't care either way but this is only true with LC_COLLATE=C and not with en_US.UTF-8.

Having a .toml file extension is good for syntax highlighters, so cargo.toml > Cargofile > Cargo.toml for me.

@wycats can you please comment on the discourse thread for this issue? there has been a lot of discussion in favor of cargo.toml instead of uppercase Cargo.toml.

I guess there isn't such a large discussion because this is mostly bikeshedding. (?)

@tbu- it kind of is, but on the other hand Cargo seems to arbitrarily choose to eschew either of the standard naming conventions for this sort of file (either cargo.toml or Cargofile) as @beatgammit explains

+1 for cargo.toml or Cargofile. I just started using Cargo and felt strange about the build filename

@headcrab-in-my-room CMake.

+1 for cargo.toml > Cargo.toml

+1 for cargo.toml

+1 for cargo.toml too

+1 for cargo.toml. I thought rust is about it's community. And I see the majority of the community wanting a lowercase project file.

Cargo.toml is fine. So is cargo.toml. I definitely don’t like Cargofile. Don’t think it’s worth getting het up over though.

Was this page helpful?
0 / 5 - 0 ratings