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
[Docs] Mojo style guide for value parameters #2557
Comments
This is an issue that has proven VERY divisive 👍 But I am on board with whatever the community decides. Personally, I prefer the following syntax. fn create_tuple[Type: DType, size: Int](value: Float32) -> StaticTuple[Type, size]: Where Types are in CamelCase, and values are in snake_case, regardless of being an argument or a parameter. |
So far, everyone who I've seen comment on this topic seems to agree that the casing rules should be uniform across arguments and parameters. So if anything, I'd say that the issue is "unifying", not "divisive". 🙂 |
That's a lot more along the lines of what I meant, I like your wording a lot more |
@arthurevans can you help us out here with the documentation? |
Where is the problem?
https://github.com/modularml/mojo/blob/4d0b45f74fbcf883c63603a762b0c5c3a11895ed/stdlib/docs/style-guide.md#code-conventions
What can we do better?
Moving a discord discussion to a Github issue here:
I noticed that the style guide (https://github.com/modularml/mojo/blob/4d0b45f74fbcf883c63603a762b0c5c3a11895ed/stdlib/docs/style-guide.md) Is recommending PascalCase for parameters that are values:
(not to be confused with type parameter
Action: Actionable
which I agree should be PascalCase).To be honest, I wasn't really doing this for values and it is really confusing with Types and Structs in my opinion.
I also noticed the stdlib isn't following this in most of the cases, and even the docstrings example a couple of lines further of the style guide isn't.
The discussion also included other arguments (some of them listed below):
My natural feeling is to use
snake_case
for these all of these cases. And the stdlib seems to be following this trend. Although the style-guide is merely a recommendation. I would greatly appreciate it to have the community on the same line for this.The text was updated successfully, but these errors were encountered: