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

RFC: Name visibility determined by capitalization of first letter. #8765

Closed
toqueteos opened this issue Aug 26, 2013 · 4 comments
Closed

RFC: Name visibility determined by capitalization of first letter. #8765

toqueteos opened this issue Aug 26, 2013 · 4 comments

Comments

@toqueteos
Copy link
Contributor

I know 0.8 is "almost there" and from what I understand Rust is now closer to removing features than adding new ones but it's not 1.0 yet so better to contribute.

I come from Go and after almost a year of using it, the best readability feature (aside from gofmt [*]) it has is not having public and private keywords, instead just looking how something is written you already know it, just by reading it without checking docs, wherever they are.

I'm moving to Rust and that's what I miss.

As always it costs something:

  • It's a big change, really big and it conflicts with how types are named right now.
  • It would require to rewrite all current std and extra code, but most of it can be automatized quite well (looking for pub and priv) then some volunteers can finish off, I'd gladly do it.

EDIT: Just as sidenote, I forgot to mention that this should support Unicode capitalisation which isn't trivial but it's still worth it and there's the guarantee that it only happens at compile time, one character per identifier.

[_]: _gofmt* is awesome and hopefully there's some folks working on rustfmt but it's not ready.

@thestinger
Copy link
Contributor

The naming conventions of TypeName, function_or_variable_name and CONSTANT_NAME are very well established and unlikely to change at this point. I don't think Foo_bar_baz is a sane naming convention so it would mean changing the name of every single function we define to FooBarBaz or fooBarBaz.

It's possible that the priv keyword would be removed because it's almost always the default, but I definitely don't see Rust enforcing a naming convention like this.

@graydon
Copy link
Contributor

graydon commented Aug 26, 2013

I'd prefer not to do this, I think we've discussed the possibility before and rejected it, happy to ask the others to confirm.

@toqueteos
Copy link
Contributor Author

@graydon My bad then, I asked on IRC and they told me nobody proposed this.

@huonw
Copy link
Member

huonw commented Dec 19, 2013

triage, as @thestinger says this would be a fundamental change to the naming conventions of the language, and so is unlikely to happen for that reason (and since this has been open 4 months without any activity, I'm going to close).

(Personally I think that capitals-for-visibility end up encoding an enforced naming inconsistency into the language, and looks kinda weird too.)

cc #8122 for the removal of priv.

@huonw huonw closed this as completed Dec 19, 2013
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

No branches or pull requests

4 participants