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

Question: naming conventions #133

Open
nikomatsakis opened this issue Feb 13, 2022 · 5 comments
Open

Question: naming conventions #133

nikomatsakis opened this issue Feb 13, 2022 · 5 comments
Labels
question Further information is requested

Comments

@nikomatsakis
Copy link
Member

I am debating whether to use Rust-like snake_case naming or Java/JS like camelCase.

On the merits, I think I would adopt camelCase:

  • camel-case is more common
  • over time, I've come to appreciate that foo.someField.someOtherField.share is easier to visually separate than foo.some_field.some_other_field.share (the . and _ kind of run together for me)
    • there's some minimal research into this which found _ vs . to be "roughly equivalent" in terms of people's ability to parse, but camel-case had a slight edge. I imagine it may be because of this phenomena.

But, I want Dada and Rust to be good buddies, and I am reluctant to introduce an impedance mismatch.

Thoughts?

@nikomatsakis nikomatsakis added the question Further information is requested label Feb 13, 2022
@nikomatsakis
Copy link
Member Author

Heh, I am realizing that I associate foo_bar with being kind of edgy and independent, and fooBar camel-case with being all conventional and stodgy. This...is probably just me and not a good basis for making a decision.

@xffxff
Copy link
Member

xffxff commented Feb 13, 2022

Personally, I prefer snake_case a bit, which separates multiple words more intuitively. And for camelCase, I may need to add a step in my mind which words it is made of. This may be because my native language is not English and I am not that sensitive to it.

@brson
Copy link
Contributor

brson commented Feb 14, 2022

I no longer remember why we chose a mix of camel caps and snake case in rust, just that it took some precedent from python. I think the outside world has often thought rust's convention is weird.

It doesn't matter a lot to me, but I do find myself getting conventions wrong in other languages because I habitually use rust conventions.

I think dada will initially attract curiosity from rust developers. It's a great opportunity to make different choices than rust where it matters. I think it probably doesn't matter here and will cause frustration and confusion (like it does when I switch between js and rust).

@brson
Copy link
Contributor

brson commented Feb 14, 2022

I do want to emphasize though that I do not have a strong opinion.

@nikomatsakis
Copy link
Member Author

I think you're right that we have to choose carefully where we choose to stray from convention, both in comparison to Rust and in comparison to other languages.

I don't exactly recall how we chose snake_case, but I think we did borrow it from Python and because _ are often used by C developers (though conventions there vary quite a bit).

I think I'm persuaded that we should stick with Rust capitalization conventions, even if I've come to vaguely prefer fooBar because of the . issue.

I am now toying with the idea of a dada format that rewrites your naming conventions. A bridge too far, probably. =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants