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

Use snake_case instead of camelCase for names #369

Open
lorisleiva opened this issue Dec 29, 2024 · 0 comments
Open

Use snake_case instead of camelCase for names #369

lorisleiva opened this issue Dec 29, 2024 · 0 comments
Labels
proposal Suggesting a change / new feature

Comments

@lorisleiva
Copy link
Member

This is a proposal that needs further discussion before implementing.


When designing the Codama standard, we needed to agree on a string casing for named nodes in order to compare them by names and went with camelCase to match the casing of node attributes.

The slight issue with camelCase is that it contains slightly less information than other casing such as Title Case or snake_case mainly due to number positioning. For instance, with snake_case we can define something like token_2022_3rd_edition without any ambiguity on the numbers 2022 and 3. On the other hand, camelCase cannot keep up with this distinction as it results in token20223rdEdition which re-snake_cased would give you token20223rd_edition.

The bottom line is, casings with explicit separators like snake_case keep more information than casing like camelCase and thus, using the former instead of the latter as a naming convention might make more sense.

This is a breaking change on the standard itself and would need to be a major version bump.

@lorisleiva lorisleiva added the proposal Suggesting a change / new feature label Dec 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal Suggesting a change / new feature
Projects
None yet
Development

No branches or pull requests

1 participant